修复文件上传组件点击删除按钮无效的问题。

master
vdpAdmin 2021-12-16 12:35:13 +08:00
parent 965af7aae2
commit b7668d3a44
2 changed files with 12 additions and 12 deletions

View File

@ -14,13 +14,15 @@
<div slot="tip" class="el-upload__tip"
v-if="!!field.options.uploadTip">{{field.options.uploadTip}}</div>
<i slot="default" class="el-icon-plus avatar-uploader-icon"></i>
<div slot="file" slot-scope="{file}" class="upload-file-list">
<span class="upload-file-name" :title="file.name">{{file.name}}</span>
<a :href="file.url" download="">
<i class="el-icon-download file-action" title="i18nt('render.hint.downloadFile')"></i></a>
<i class="el-icon-delete file-action" title="i18nt('render.hint.removeFile')" v-if="!field.options.disabled"
@click="removeUploadFile(file.name)"></i>
</div>
<template #file="{ file }">
<div class="upload-file-list">
<span class="upload-file-name" :title="file.name">{{file.name}}</span>
<a :href="file.url" download="">
<i class="el-icon-download file-action" title="i18nt('render.hint.downloadFile')"></i></a>
<i class="el-icon-delete file-action" title="i18nt('render.hint.removeFile')" v-if="!field.options.disabled"
@click="removeUploadFile(file.name)"></i>
</div>
</template>
</el-upload>
</form-item-wrapper>
</template>
@ -182,6 +184,7 @@
if (file.status === 'success') {
//this.fileList.push(file) /* this.fileList!! */
this.updateUploadFieldModelAndEmitDataChange(fileList)
this.fileList = deepClone(fileList)
this.uploadBtnHidden = fileList.length >= this.field.options.limit
}
@ -189,7 +192,7 @@
},
handleFileRemove(file, fileList) {
this.fileList = fileList
this.fileList = deepClone(fileList) //this.fileList = fileList
this.updateUploadFieldModelAndEmitDataChange(fileList)
this.uploadBtnHidden = fileList.length >= this.field.options.limit

View File

@ -76,9 +76,6 @@
fileList: [], //
uploadBtnHidden: false,
// styleVariables: {
// '--select-file-action': selectFileText,
// },
}
},
computed: {
@ -179,7 +176,7 @@
},
handlePictureRemove(file, fileList) {
this.fileList = fileList
this.fileList = deepClone(fileList) //this.fileList = fileList
this.updateUploadFieldModelAndEmitDataChange(fileList)
this.uploadBtnHidden = fileList.length >= this.field.options.limit