From 0a83a9adf93439c47b4b8752637e5d58be5e35bb Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Tue, 3 Feb 2026 19:21:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(upload):=20=E4=BF=AE=E5=A4=8D=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=A7=E5=B0=8F=E6=A0=A1=E9=AA=8C=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E5=90=8E=E4=BB=8D=E8=A2=AB=E5=8A=A0=E5=85=A5=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 通过返回 Upload.LIST_IGNORE 替代 false,防止不符合大小限制的文件被加入上传文件列表,解决 Safari 浏览器兼容性问题。 --- apps/web-antd/src/components/upload/src/hook.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/web-antd/src/components/upload/src/hook.ts b/apps/web-antd/src/components/upload/src/hook.ts index f7451518..3fed8c8b 100644 --- a/apps/web-antd/src/components/upload/src/hook.ts +++ b/apps/web-antd/src/components/upload/src/hook.ts @@ -22,7 +22,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'; import { $t } from '@vben/locales'; -import { message, Modal } from 'ant-design-vue'; +import { message, Modal, Upload } from 'ant-design-vue'; import { isFunction, isString } from 'lodash-es'; import { ossInfo } from '#/api/system/oss'; @@ -271,7 +271,8 @@ export function useUpload( const isLtMax = file.size / 1024 / 1024 < props.maxSize!; if (!isLtMax) { message.error($t('component.upload.maxSize', [props.maxSize])); - return false; + // 防止被加入文件列表 可以通过返回 Upload.LIST_IGNORE 实现。 + return Upload.LIST_IGNORE; } // 大坑 Safari不支持file-type库 去除文件类型的校验 return file;