refactor(antdv-next): 将message组件调用统一改为window.message

将项目中直接导入的antdv-next的message组件调用改为通过window.message调用,提升代码一致性
移除不再需要的message组件导入
新增api-switch组件用于统一处理状态切换逻辑
This commit is contained in:
dap
2026-01-15 09:35:54 +08:00
parent 2312f438ac
commit ee1b37c787
23 changed files with 211 additions and 90 deletions

View File

@@ -22,7 +22,7 @@ import { computed, onUnmounted, ref, watch } from 'vue';
import { $t } from '@vben/locales';
import { message, Modal } from 'antdv-next';
import { Modal } from 'antdv-next';
import { isFunction, isString } from 'lodash-es';
import { ossInfo } from '#/api/system/oss';
@@ -270,7 +270,7 @@ export function useUpload(
function beforeUpload(file: FileType) {
const isLtMax = file.size / 1024 / 1024 < props.maxSize!;
if (!isLtMax) {
message.error($t('component.upload.maxSize', [props.maxSize]));
window.message.error($t('component.upload.maxSize', [props.maxSize]));
return false;
}
// 大坑 Safari不支持file-type库 去除文件类型的校验
@@ -301,7 +301,7 @@ export function useUpload(
});
info.onSuccess!(res);
if (props.showSuccessMsg) {
message.success($t('component.upload.uploadSuccess'));
window.message.success($t('component.upload.uploadSuccess'));
}
emit('success', info.file as RcFile, res);
} catch (error: any) {