upfile:function() {
//发送反馈
var newItems = [];
const storage = uni.getStorageSync('setUserData');
for (var i = 0; i < this.imageList.length; i++) {
uni.uploadFile({
url: '/upload',
header: {
Authorization: storage.accesstoken
},
filePath: this.imageList[i],
name: 'image' + i,
success: res => {
},
fail: res => {
console.log(res);
},
complete: res => {
if (res.statusCode === 200) {
newItems.push(JSON.parse(res.data).data);
}
}
});
}
return newItems;
},
send(){
let urlItems = this.upfile();
console.log(urlItems);
}
请问大大们,为什么执行send的时候没等图片上传完返回图片存储地址,就执行console了,是我哪里写错了吗
另外同步的代码怎么写呢?我没看懂。新人小白
0 个回复