fix: 处理router.多语言显示

This commit is contained in:
TsMask
2023-11-17 11:16:08 +08:00
parent 69bd3879b1
commit bb577bef0b
5 changed files with 69 additions and 6 deletions

View File

@@ -12,7 +12,12 @@ import * as echarts from 'echarts/core';
import { TitleComponent, LegendComponent } from 'echarts/components';
import { PieChart } from 'echarts/charts';
import { LabelLayout } from 'echarts/features';
import { useRoute } from 'vue-router';
import useAppStore from '@/store/modules/app';
const appStore = useAppStore();
const route = useRoute();
const { t } = useI18n();
echarts.use([
TooltipComponent,
GaugeChart,
@@ -370,7 +375,20 @@ function rowClick(record: any, index: any) {
};
}
let timer: any;
/**
* 国际化翻译转换
*/
function fnLocale( ) {
let title = route.meta.title as string;
if (title.indexOf('router.') !== -1) {
title = t(title);
}
appStore.setTitle(title);
}
onMounted(() => {
fnLocale()
fnGetList();
timer = setInterval(fnGetList, 10000); // 每隔10秒执行一次
});