diff --git a/src/views/util/uploadFile/index.vue b/src/views/util/uploadFile/index.vue index ba25c46..a672a6e 100644 --- a/src/views/util/uploadFile/index.vue +++ b/src/views/util/uploadFile/index.vue @@ -66,6 +66,17 @@ export default { this.$refs.uploadFile.clearFiles() 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) }, onRemove(file, fileList) {