地址:https://ext.dcloud.net.cn/plugin?id=2393
页面示例
引入
import shmilyDragImage from '@/components/shmily-drag-image/shmily-drag-image.vue'
return 内容
tempFilePaths: [],
imgArr:[],
//上传详情图
addImage(){
var _that = this;
uni.chooseImage({
count:1,
success: (chooseImageRes) => {
this.tempFilePaths=[];
this.tempFilePaths.push(chooseImageRes.tempFilePaths);
this.tempFilePaths.forEach(ele=>{
ele.forEach(item=>{
uni.uploadFile({
url: web.url + '/admin/Image/upload',
filePath:item,
name: 'file',
header: {
'token':uni.getStorageSync('token')
},
formData: {},
success: (uploadFileRes) => {
var resImg = jsON.parse(uploadFileRes.data);
_that.$refs.dragImage.addImage(web.url + resImg.path);
}
});
})
})
},
});
},
原创©本文章为王少铮原创,未经许可,禁止转载
0条评论