mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat: 完成代码生成模板(1.0)
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user