直接上代碼了
<van-uploader :file-list="fileList"
multiple
result-type="file"
:after-read="handleUpload" />
methods: {
async handleUpload(event) {
this.$loading.open('上傳中')
let { rows } = await uploadImg({
file: event.map(item => item.file)
})
console.log(rows)
this.fileList.push(...rows)
this.$loading.close()
this.$toast.success('上傳成功')
},
},
我們直接綁定上傳方法即可
喜歡上方小程序,需要源碼的,私信小編留下郵箱。