import { defineStore } from 'pinia' export const useStore = defineStore('chronic', { state: () => { return { // 字典 dict: [], //居民信息 userInfo: {} } }, getters: {}, actions: { getDict(dict) { if (!dict) return [] return this.dict[dict] || [] }, getUserInfo(info) { if (!info) return {} return this.userInfo[info] || [] }, getDictValue(dict, value) { let array = [] if (typeof dict === 'string') { array = this.dict[dict] } else { array = dict } if (!array || !array.length) { return '' } let temp = array.find(e => e.value == value) || {} return temp.name || '' } } })