add dict.js
This commit is contained in:
parent
2e8391bfc7
commit
f50648b1ef
17
src/utils/dict.js
Normal file
17
src/utils/dict.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { getDicts } from '@/api/system/dict/data'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典数据
|
||||||
|
*/
|
||||||
|
export function useDict(...args) {
|
||||||
|
const res = ref({});
|
||||||
|
return (() => {
|
||||||
|
args.forEach((d, index) => {
|
||||||
|
res.value[d] = [];
|
||||||
|
getDicts(d).then(resp => {
|
||||||
|
res.value[d] = resp.data.map(p => ({ label: p.dictLabel, value: p.dictValue, listClass: p.listClass, cssClass: p.cssClass }))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return toRefs(res.value);
|
||||||
|
})()
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user