uni.uploadFile({
url: 'https://dev.tmwork.api.cn/mini/image', //仅为示例,非真实的接口地址
header: {
Authorization: 'Bearer ' + uni.getStorageSync('token'),
},
filePath:e.tempFilePaths[0],
formData: {},
name: 'imgName',
success: uploadFileRes => {
uploadFileRes.data = JSON.parse(uploadFileRes.data).data;
if (this.imgList.length != 0) {
this.imgList = this.imgList.concat({
path: e.tempFilePaths,
url: uploadFileRes.data
});
} else {
this.imgList = [
{
path: e.tempFilePaths,
url: uploadFileRes.data
}
];
}
}
});