From e259093e01a924469ed599fd3311c5b2fc04d49b Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 8 Jul 2021 15:49:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=B7=BB=E5=8A=A0=E6=95=B0=E9=87=8F=E9=99=90=E5=88=B6?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/components/FileUpload/index.vue | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue index 649e077..6e7992a 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/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("上传失败, 请重试");