let arr = [];
const upImg = (file) => {
arr.push(
new Promise((resolve) => {
let formData = new FormData();
formData.append("imgFile", file);
fileUpload(formData).then((res) => {
this.imgList.push(res.data);
resolve(res);
});
})
);
};
this.fileList.map((item) => {
upImg(item.raw);
});
Promise.all(arr).then((result) => {
console.log(this.imgList);
});
网友评论