fix: 静态路由菜单国际化/切换刷新

This commit is contained in:
TsMask
2023-11-11 11:44:21 +08:00
parent 1c82719af0
commit 3ae8a7c237
6 changed files with 48 additions and 12 deletions

View File

@@ -92,6 +92,16 @@ function fnTabClose(path: string) {
router.push(to);
}
/**
* 国际化翻译转换
*/
function fnLocale(title: string) {
if (title.indexOf('router.') !== -1) {
title = t(title);
}
return title;
}
/**监听当前路由添加到导航标签列表 */
watch(router.currentRoute, v => tabsStore.tabOpen(v), { immediate: true });
</script>
@@ -120,7 +130,7 @@ watch(router.currentRoute, v => tabsStore.tabOpen(v), { immediate: true });
<template #tab>
<span>
<IconFont :type="tab.icon" style="margin: 0"></IconFont>
{{ tab.title }}
{{ fnLocale(tab.title) }}
</span>
</template>
</a-tab-pane>