From 1d3b718740f65eff97bd3ac7c9ebff6ec9fd083d Mon Sep 17 00:00:00 2001 From: liujun Date: Tue, 27 Feb 2024 11:03:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/util/uploadFile/index.vue | 11 +++++++++++ 1 file changed, 11 insertions(+) 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) {