mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-03-13 13:40:52 +08:00
fix(upload): 返回 Upload.LIST_IGNORE 防止超大文件被加入列表
修复 Safari 浏览器下文件类型校验问题,同时确保上传文件大小超过限制时,通过返回 Upload.LIST_IGNORE 来阻止文件被加入待上传列表,避免界面显示异常。
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user