feat: use vben/utils upload

This commit is contained in:
xingyu4j
2025-11-18 17:33:39 +08:00
parent ec23e8acf6
commit 60854e59f1
8 changed files with 26 additions and 38 deletions

View File

@@ -13,13 +13,18 @@ import { computed, ref, toRefs, watch } from 'vue';
import { IconifyIcon } from '@vben/icons';
import { $t } from '@vben/locales';
import { isFunction, isNumber, isObject, isString } from '@vben/utils';
import {
checkFileType,
isFunction,
isNumber,
isObject,
isString,
} from '@vben/utils';
import { Button, Upload } from 'tdesign-vue-next';
import { message } from '#/adapter/tdesign';
import { checkFileType } from './helper';
import { UploadResultStatus } from './typing';
import { useUpload, useUploadType } from './use-upload';

View File

@@ -1,8 +0,0 @@
export function checkFileType(file: File, accepts: string[]) {
if (!accepts || accepts.length === 0) {
return true;
}
const newTypes = accepts.join('|');
const reg = new RegExp(`${String.raw`\.(` + newTypes})$`, 'i');
return reg.test(file.name);
}