这篇文章主要为大家详细介绍了vue+elementUI实现图片上传功能,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
本文实例为大家分享了vue+elementUI图片上传的具体代码,供大家参考,具体内容如下
1、html
<i class="el-icon-plus"></i><!--大图弹出框-->
2、定义
dialogImageUrl: '', imgDialogVisible: false, fileLists: [],
3、在需要使用的方法中给fileLists[]赋值
vm.fileLists = []; if (row.logo != undefined && row.logo != "") { vm.fileLists.push({url:row.logo}); }
4、其他几个属性的方法
//删除图片 handleRemove(file, fileList) { this.form.logo='' }, //查看大图 handlePictureCardPreview(file) { this.dialogImageUrl = file.url; this.imgDialogVisible = true; }, //图片上传成功 success(response, file, fi<strong>本文来源gaodaima#com搞(代@码$网6</strong>leList) { this.fileLists = []; this.fileLists = [file] this.form.logo = file.response.result; },
5、图片上传的位置和路径是存在不同的表中。
以上就是vue+elementUI实现图片上传功能的详细内容,更多请关注gaodaima搞代码网其它相关文章!