<el-upload
:action="$store.state.baseURL+'/commonFile/upload.do'"
list-type="picture-card"
:on-success="handleSuccess"
:on-preview="handlePictureCardPreview"
:file-list="fileList"
:on-remove="handleRemove">
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
// 文件上传成功
handleSuccess(response, file, fileList) {
console.log(file)
console.log(fileList)
this.fileList = fileList.map(res => {
if(res.raw) {
return {
name: res.name,
id: res.response.data,
status: res.status,
raw: res.raw,
url: res.url
}
}else {
return {
name: res.name,
id: res.id,
status: res.status,
url: res.url
}
}
})
console.log(this.fileList)
},
handlePictureCardPreview(file) {
console.log(file)
this.dialogImageUrl = file.url;
this.dialogVisible = true;
}
handleRemove(file, fileList) {
console.log(file)
console.log(fileList)
this.fileList = fileList;
},