el-upload携带参数data

无敌的宇宙
无敌的宇宙
擅长邻域:Java,HTML,JavaScript,MySQL,支付,退款,图片上传

分类: vue 专栏: vue 标签: el-upload携带参数data

2023-05-19 21:22:44 408浏览

el-upload携带参数data
<el-upload
drag
:before-upload="beforeUploadFile_vimg"
:show-file-list="false"
:action=FILE_ACTION
:on-success="handleFileSuccess_vimg"
accept="image/*"
:data="{type:'vimg',oldf: dataForm.vimg}"
:multiple="false">

<img v-if="dataForm.vimg!=null&&dataForm.vimg!=''" :src="FILE_URL+dataForm.vimg" style="width: 100px;height: 100px;border-radius:5%">

<i class="el-icon-upload2" v-else size="max"></i>
</el-upload>
beforeUploadFile_vimg(){


this.loading = this.$loading({
lock: true,
text: "上传中,请稍等,,,,",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.5)",
});
},
handleFileSuccess_vimg(res) {
this.loading.close();
console.log(res)
if( res.status==1){

this.$message.success( '上传成功' );
this.dataForm.vimg=res.data;
}else{
this.$message.error( '上传失败' );
}

},
this.FILE_URL=process.env.VUE_APP_API_ROOT;
this.FILE_ACTION=process.env.VUE_APP_API_ROOT+'/common/upfile';

好博客就要一起分享哦!分享海报

此处可发布评论

评论(0展开评论

暂无评论,快来写一下吧

展开评论

您可能感兴趣的博客

客服QQ 1913284695