vue+elementUI图片上传

1、html



	
	    
	
	
	
		
	

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, fileList) {
	this.fileLists = [];
	this.fileLists = [file]
	this.form.logo = file.response.result;
},
5、图片上传的位置和路径是存在不同的表中。



你可能感兴趣的:(前端)