You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
464 B
TypeScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { computed } from 'vue';
import { useOptionsStore } from '@/stores/modules/options';
import type { DictCustom } from '@/api/types/system/dict';
/**
* 自定义 Hook用于从 store 中获取字典选项
* @param dictName 字典名称
* @returns 返回字典选项
*/
export const useDictOptions = (dictName: string) => {
const optionsStore = useOptionsStore();
return computed<DictCustom[]>(() => optionsStore.getDictOptions(dictName) || []);
};