for (let l in this.data.DetailsImage) {
wx.cloud.uploadFile({
cloudPath: '商品/' + yonghu.xingming + new Date().getTime() + '.png',
filePath: this.data.DetailsImage[l].tempFilePath,
}).then(res => {
console.log(res)
this.data.DetailsImages.push(res.fileID)
console.log(this.data.DetailsImages)
})
}
console.log(this.data.DetailsImages)
wx.cloud.database().collection('commodity')
.add({
data: {
Name: this.data.Name,
Money: this.data.Money,
SuggestMoney: this.data.SuggestMoney,
Supplier: this.data.supplier.Name,
Comment: this.data.Text,
HomeImage: this.data.HomeImage,
DetailsImages: this.data.DetailsImages,
Time: Date.now()
}
}).then(res => {
console.log(res)
wx.hideLoading()
})
异步问题,把这坨代码挪上去
JS异步问题