12345678910111213141516171819202122232425 |
- import { ref } from 'vue';
- import { getDictTypeData } from '@/api';
- import type { DictCode } from '@/constants';
- import type { DictValue } from '@/types';
- export const useDictData = (dictCode: DictCode) => {
- const dictData = ref<DictValue[]>([]);
- const getDictData = async () => {
- const data = await getDictTypeData({
- dictCode,
- });
- if (data.length) {
- dictData.value = data[0].dictTypeDataList;
- }
- };
- return {
- dictData,
- getDictData,
- };
- };
|