放弃vuex改用pinia (#872)

Co-authored-by: bypanghu <bypanghu@163.com>
This commit is contained in:
奇淼(piexlmax
2022-01-07 12:29:32 +08:00
committed by GitHub
parent eca5967b4d
commit 727caf3f4f
60 changed files with 681 additions and 918 deletions

View File

@@ -1,6 +1,7 @@
import { store } from '@/store'
import { useDictionaryStore } from '@/pinia/modules/dictionary'
// 获取字典方法 使用示例 getDict('sex').then(res) 或者 async函数下 const res = await getDict('sex')
export const getDict = async(type) => {
await store.dispatch('dictionary/getDictionary', type)
return store.getters['dictionary/getDictionary'][type]
const dictionaryStore = useDictionaryStore()
await dictionaryStore.getDictionary(type)
return dictionaryStore.dictionaryMap[type]
}