forEach的用法

this.listData.forEach(ele => {
if (ele.imgUrl) {
num++
axios({
url: `/file/views/${ele.imgUrl}`,
methods: 'get',
responseType: 'blob',
}).then((data) => {
let blob = data.data;
let src = window.URL.createObjectURL(blob)
// ele.imgSrc = src
this.$set(ele,'imgSrc',src)
console.log(data)
num--
})
}
})
posted @ 2019-05-23 17:26  苏小白啊  阅读(785)  评论(0编辑  收藏  举报