文件名重复问题修复

pull/11/head
liujun 2024-02-27 11:03:55 +08:00
parent c67f6773b9
commit 1d3b718740
1 changed files with 11 additions and 0 deletions

View File

@ -66,6 +66,17 @@ export default {
this.$refs.uploadFile.clearFiles() this.$refs.uploadFile.clearFiles()
return false return false
} }
let nameNumber = 0
for (let j = 0; j < fileList.length; j++) {
if (fileList[j].name === file.name) {
nameNumber = nameNumber + 1
}
}
if (nameNumber > 1) {
this.$message.error('文件名重复,请重新选择!')
this.$refs.uploadFile.handleRemove(file)
return false
}
this.$emit('update:fileList', fileList) this.$emit('update:fileList', fileList)
}, },
onRemove(file, fileList) { onRemove(file, fileList) {