import { getDicts } from '@/api/system/dict.js'; import {ref,toRefs} from 'vue' function setDict(_key, value) { const dict = []; if (_key !== null && _key !== "") { dict.push({ key: _key, value: value }); } return dict; } export function useDict(...args) { const res = ref({}); return (() => { args.forEach((dictType, index) => { res.value[dictType] = []; getDicts(dictType).then(resp => { res.value[dictType] = resp.data.map(p => ({ label: p.dictLabel, value: p.dictValue, elTagType: p.listClass, elTagClass: p.cssClass })) setDict(dictType, res.value[dictType]); }) }) return toRefs(res.value); })() }