优化全局注入dict_data

This commit is contained in:
XIE7654
2025-07-16 13:56:02 +08:00
parent baa650ea64
commit 3fe272ffca
11 changed files with 219 additions and 24 deletions

View File

@@ -0,0 +1,18 @@
// src/store/dict.ts
import { defineStore } from 'pinia';
import { getDictDataSimple } from '#/api/system/dict_data'; // 根据实际路径调整
export const useDictStore = defineStore('dict', {
state: () => ({
dictData: [] as any[],
}),
actions: {
async fetchDictData() {
this.dictData = await getDictDataSimple(); // 根据接口返回结构调整
},
getOptionsByType(type: string) {
return this.dictData.filter((item) => item.dict_type === type);
},
},
});