From 3c8d6136231c753777a4c162835b123374aaad86 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Tue, 3 Feb 2026 19:18:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(upload):=20=E8=BF=94=E5=9B=9E=20Upload.LIST?= =?UTF-8?q?=5FIGNORE=20=E9=98=B2=E6=AD=A2=E8=B6=85=E5=A4=A7=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=A2=AB=E5=8A=A0=E5=85=A5=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 Safari 浏览器下文件类型校验问题,同时确保上传文件大小超过限制时,通过返回 Upload.LIST_IGNORE 来阻止文件被加入待上传列表,避免界面显示异常。 --- apps/web-antd/src/components/upload/src/hook.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/web-antd/src/components/upload/src/hook.ts b/apps/web-antd/src/components/upload/src/hook.ts index 327d43e9..ad87b914 100644 --- a/apps/web-antd/src/components/upload/src/hook.ts +++ b/apps/web-antd/src/components/upload/src/hook.ts @@ -17,6 +17,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'; import { $t } from '@vben/locales'; +import { Upload } from 'antdv-next'; import { isFunction, isString } from 'lodash-es'; import { ossInfo } from '#/api/system/oss'; @@ -267,7 +268,8 @@ export function useUpload( const isLtMax = file.size / 1024 / 1024 < props.maxSize!; if (!isLtMax) { window.message.error($t('component.upload.maxSize', [props.maxSize])); - return false; + // 防止被加入文件列表 可以通过返回 Upload.LIST_IGNORE 实现。 + return Upload.LIST_IGNORE; } // 大坑 Safari不支持file-type库 去除文件类型的校验 return file;