feat:【代码优化】use-dict-select.ts 的 API 导入问题,不在 import *

This commit is contained in:
YunaiV
2025-10-27 08:44:07 +08:00
parent 9651ec49a6
commit b7d32e315b
2 changed files with 10 additions and 6 deletions

View File

@@ -1,8 +1,10 @@
import type { SystemDictTypeApi } from '#/api/system/dict/type';
import { onMounted, ref } from 'vue';
import { buildUUID, cloneDeep } from '@vben/utils';
import * as DictDataApi from '#/api/system/dict/type';
import { getSimpleDictTypeList } from '#/api/system/dict/type';
import {
localeProps,
makeRequiredRule,
@@ -18,12 +20,12 @@ export const useDictSelectRule = () => {
const rules = cloneDeep(selectRule);
const dictOptions = ref<{ label: string; value: string }[]>([]); // 字典类型下拉数据
onMounted(async () => {
const data = await DictDataApi.getSimpleDictTypeList();
const data = await getSimpleDictTypeList();
if (!data || data.length === 0) {
return;
}
dictOptions.value =
data?.map((item: DictDataApi.SystemDictTypeApi.DictType) => ({
data?.map((item: SystemDictTypeApi.DictType) => ({
label: item.name,
value: item.type,
})) ?? [];