mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 菜单字典适配 i18n
This commit is contained in:
@ -1,11 +1,17 @@
|
||||
import { ref } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
import { $t } from '@/locales';
|
||||
|
||||
export const useDictStore = defineStore('dict', () => {
|
||||
const dictData = ref<{ [key: string]: Api.System.DictData[] }>({});
|
||||
|
||||
const getDict = (key: string) => {
|
||||
return dictData.value[key];
|
||||
return dictData.value[key]?.map(item => ({
|
||||
...item,
|
||||
dictLabel: item.dictLabel?.startsWith(`dict.${item.dictType}.`)
|
||||
? $t(item.dictLabel as App.I18n.I18nKey)
|
||||
: item.dictLabel
|
||||
}));
|
||||
};
|
||||
|
||||
const setDict = (key: string, dict: Api.System.DictData[]) => {
|
||||
|
Reference in New Issue
Block a user