protable组件抽取,并绘制demo界面
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { AuthState } from "@/stores/interface";
|
||||
import { getAuthButtonListApi, getAuthMenuListApi } from "@/api/modules/login";
|
||||
import { getAuthButtonListApi, getAuthMenuListApi } from "@/api/user/login";
|
||||
import {
|
||||
getFlatMenuList,
|
||||
getShowMenuList,
|
||||
|
||||
22
frontend/src/stores/modules/dict.ts
Normal file
22
frontend/src/stores/modules/dict.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import piniaPersistConfig from '@/stores/helper/persist'
|
||||
import { DICT_STORE_KEY } from '@/stores/constant'
|
||||
// 模拟数据
|
||||
import dictData from '@/api/system/dictData'
|
||||
|
||||
export const useDictStore = defineStore({
|
||||
id: DICT_STORE_KEY,
|
||||
state: () => ({
|
||||
dictData,
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
// 获取字典数据数组,如果为空则返回空数组
|
||||
getDictData(code: string) {
|
||||
const dict = this.dictData.find(item => item.code === code )
|
||||
return dict?.children || []
|
||||
},
|
||||
// 初始化获取全部字典数据并缓存
|
||||
},
|
||||
persist: piniaPersistConfig(DICT_STORE_KEY),
|
||||
})
|
||||
Reference in New Issue
Block a user