feat: 完成代码生成模板(1.0)

This commit is contained in:
xlsea
2024-09-08 21:47:56 +08:00
parent 2e0b16d0b3
commit ff3ed20bba
13 changed files with 474 additions and 40 deletions

View File

@ -1,9 +1,11 @@
import { ref } from 'vue';
import { ref, watch } from 'vue';
import { storeToRefs } from 'pinia';
import { fetchGetDictDataByType } from '@/service/api/system';
import { useDictStore } from '@/store/modules/dict';
export function useDict(dictType: string, immediate: boolean = true) {
const dictStore = useDictStore();
const { dictData: dictList } = storeToRefs(dictStore);
const data = ref<Api.System.DictData[]>([]);
const record = ref<Record<string, string>>({});
@ -43,6 +45,17 @@ export function useDict(dictType: string, immediate: boolean = true) {
getRecord();
getOptions();
});
} else {
watch(
() => dictList.value[dictType],
val => {
if (val && val.length) {
getRecord();
getOptions();
}
},
{ immediate: true }
);
}
return {