You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
703 B
TypeScript
39 lines
703 B
TypeScript
import { defineStore } from 'pinia'
|
|
import { store } from '../index'
|
|
|
|
export interface DictState {
|
|
isSetDict: boolean
|
|
dictObj: Recordable
|
|
}
|
|
|
|
export const useDictStore = defineStore({
|
|
id: 'dict',
|
|
state: (): DictState => ({
|
|
isSetDict: false,
|
|
dictObj: {}
|
|
}),
|
|
persist: {
|
|
enabled: true
|
|
},
|
|
getters: {
|
|
getDictObj(): Recordable {
|
|
return this.dictObj
|
|
},
|
|
getIsSetDict(): boolean {
|
|
return this.isSetDict
|
|
}
|
|
},
|
|
actions: {
|
|
setDictObj(dictObj: Recordable) {
|
|
this.dictObj = dictObj
|
|
},
|
|
setIsSetDict(isSetDict: boolean) {
|
|
this.isSetDict = isSetDict
|
|
}
|
|
}
|
|
})
|
|
|
|
export const useDictStoreWithOut = () => {
|
|
return useDictStore(store)
|
|
}
|