feat:【代码优化】use-dict-select.ts 的 API 导入问题,不在 import *
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
|
import type { SystemDictTypeApi } from '#/api/system/dict/type';
|
||||||
|
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
import { buildUUID, cloneDeep } from '@vben/utils';
|
import { buildUUID, cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
import * as DictDataApi from '#/api/system/dict/type';
|
import { getSimpleDictTypeList } from '#/api/system/dict/type';
|
||||||
import {
|
import {
|
||||||
localeProps,
|
localeProps,
|
||||||
makeRequiredRule,
|
makeRequiredRule,
|
||||||
@@ -18,12 +20,12 @@ export function useDictSelectRule() {
|
|||||||
const rules = cloneDeep(selectRule);
|
const rules = cloneDeep(selectRule);
|
||||||
const dictOptions = ref<{ label: string; value: string }[]>([]); // 字典类型下拉数据
|
const dictOptions = ref<{ label: string; value: string }[]>([]); // 字典类型下拉数据
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const data = await DictDataApi.getSimpleDictTypeList();
|
const data = await getSimpleDictTypeList();
|
||||||
if (!data || data.length === 0) {
|
if (!data || data.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dictOptions.value =
|
dictOptions.value =
|
||||||
data?.map((item: DictDataApi.SystemDictTypeApi.DictType) => ({
|
data?.map((item: SystemDictTypeApi.DictType) => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
value: item.type,
|
value: item.type,
|
||||||
})) ?? [];
|
})) ?? [];
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
|
import type { SystemDictTypeApi } from '#/api/system/dict/type';
|
||||||
|
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
import { buildUUID, cloneDeep } from '@vben/utils';
|
import { buildUUID, cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
import * as DictDataApi from '#/api/system/dict/type';
|
import { getSimpleDictTypeList } from '#/api/system/dict/type';
|
||||||
import {
|
import {
|
||||||
localeProps,
|
localeProps,
|
||||||
makeRequiredRule,
|
makeRequiredRule,
|
||||||
@@ -18,12 +20,12 @@ export const useDictSelectRule = () => {
|
|||||||
const rules = cloneDeep(selectRule);
|
const rules = cloneDeep(selectRule);
|
||||||
const dictOptions = ref<{ label: string; value: string }[]>([]); // 字典类型下拉数据
|
const dictOptions = ref<{ label: string; value: string }[]>([]); // 字典类型下拉数据
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const data = await DictDataApi.getSimpleDictTypeList();
|
const data = await getSimpleDictTypeList();
|
||||||
if (!data || data.length === 0) {
|
if (!data || data.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dictOptions.value =
|
dictOptions.value =
|
||||||
data?.map((item: DictDataApi.SystemDictTypeApi.DictType) => ({
|
data?.map((item: SystemDictTypeApi.DictType) => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
value: item.type,
|
value: item.type,
|
||||||
})) ?? [];
|
})) ?? [];
|
||||||
|
|||||||
Reference in New Issue
Block a user