useDict.ts 292 B

123456789
  1. import { computed } from 'vue'
  2. import { useAppStore } from '@/stores/app'
  3. import type { DictItem } from '@/utils/global'
  4. export function useDict(dictName: string) {
  5. const appStore = useAppStore()
  6. const dict = computed<DictItem[]>(() => appStore.dict[dictName] || [])
  7. return { dict }
  8. }