|
|
@@ -1,4 +1,4 @@
|
|
|
-import {onMounted, reactive, watch} from 'vue';
|
|
|
+import {computed, onMounted, reactive, watch} from 'vue';
|
|
|
import {useTabStore, storeToRefs} from '@stores';
|
|
|
import {find} from 'lodash-es';
|
|
|
import {useRoute, useRouter} from 'vue-router';
|
|
|
@@ -6,6 +6,7 @@ import {formatMenu} from '@utils';
|
|
|
import {useQueryClient} from '@tanstack/vue-query';
|
|
|
import {MenuListData} from '@models';
|
|
|
import {getMenuByUserId} from '@apis';
|
|
|
+import {useI18n} from 'vue-i18n';
|
|
|
|
|
|
export function useMenu() {
|
|
|
const queryClient = useQueryClient();
|
|
|
@@ -26,7 +27,11 @@ export function useMenu() {
|
|
|
...(data ?? []),
|
|
|
];
|
|
|
|
|
|
- const menuOptions = formatMenu(basicMenu);
|
|
|
+ const {locale} = useI18n();
|
|
|
+
|
|
|
+ const menuOptions = computed(function() {
|
|
|
+ return formatMenu(basicMenu, locale.value);
|
|
|
+ });
|
|
|
|
|
|
const tabStore = useTabStore();
|
|
|
const {activeKey, tabList} = storeToRefs(tabStore);
|
|
|
@@ -40,7 +45,7 @@ export function useMenu() {
|
|
|
|
|
|
function onUpdate(
|
|
|
key: string,
|
|
|
- item: typeof menuOptions[0],
|
|
|
+ item: typeof menuOptions.value[0],
|
|
|
) {
|
|
|
const {label, pId, url, koLabel} = item;
|
|
|
|