From 4f5964f287fdcda31dd842f716676bb63af44798 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 16 Feb 2022 21:38:04 +0800 Subject: [PATCH] =?UTF-8?q?v3.6.0=20=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=B7=BB=E5=8A=A0=E6=95=B0=E9=87=8F=E9=99=90?= =?UTF-8?q?=E5=88=B6=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-admin/src/components/FileUpload/index.vue | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/yudao-ui-admin/src/components/FileUpload/index.vue b/yudao-ui-admin/src/components/FileUpload/index.vue index c340007c4..5813c8bbe 100644 --- a/yudao-ui-admin/src/components/FileUpload/index.vue +++ b/yudao-ui-admin/src/components/FileUpload/index.vue @@ -4,7 +4,9 @@ :action="uploadFileUrl" :before-upload="handleBeforeUpload" :file-list="fileList" + :limit="limit" :on-error="handleUploadError" + :on-exceed="handleExceed" :on-success="handleUploadSuccess" :show-file-list="false" :headers="headers" @@ -44,6 +46,11 @@ export default { props: { // 值 value: [String, Object, Array], + // 数量限制 + limit: { + type: Number, + default: 5, + }, // 大小限制(MB) fileSize: { type: Number, @@ -129,6 +136,10 @@ export default { } return true; }, + // 文件个数超出 + handleExceed() { + this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`); + }, // 上传失败 handleUploadError(err) { this.$message.error("上传失败, 请重试");