element-ui 上传完成编辑回显删除对应的图片
2019-08-08 本文已影响0人
嫑着急
handleRemove(file, fileList) {
// console.log(file,file.response.msg);
// console.log(file)
if (file.response) {
const index = this.dpgl.Sfz.findIndex(fruit => fruit === file.response.msg);
// console.log(index) //他的下标
// console.log(this.dpgl.Sfz[index]) //他的路径
if (index != '-1') {
this.dpgl.Sfz.splice(index, 1)
}
} else {
const index = this.dpgl.Sfz.findIndex(fruit => fruit === file.url);
// console.log(index) //他的下标
// console.log(this.dpgl.Sfz[index]) //他的路径
if (index != '-1') {
this.dpgl.Sfz.splice(index, 1)
}
}
},
//上传成功push到 Sfz数组当中
Success(file) {
this.dpgl.Sfz.push(file.msg)
// console.log(this.dpgl.Sfz)
},