1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| import {ref, toRefs} from "vue";
| import {getDicts} from "@/api/system/dict/data";
|
| export function useDict(...args: string[]) {
| const res = ref<string[]>({...args});
| return (() => {
| args.forEach((d, index) => {
| // @ts-ignore
| res.value[d] = [];
| getDicts(d).then(resp => {
| // @ts-ignore
| res.value[d] = resp.data.map((p: any) => ({
| label: p.dictLabel,
| value: p.dictValue,
| elTagType: p.listClass
| }))
| })
| })
| return toRefs(res.value);
| })()
|
| }
|
|