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

@@ -6,7 +6,11 @@ import { reactive, ref, onMounted } from 'vue';
import { parseDateToStr } from '@/utils/date-utils';
import useUserStore from '@/store/modules/user';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { useRoute } from 'vue-router';
import useAppStore from '@/store/modules/app';
import useI18n from '@/hooks/useI18n';
const appStore = useAppStore();
const route = useRoute();
const { t } = useI18n();
/**加载状态 */
@@ -71,7 +75,19 @@ function fnGetProfile() {
});
}
/**
* 国际化翻译转换
*/
function fnLocale() {
let title = route.meta.title as string;
if (title.indexOf('router.') !== -1) {
title = t(title);
}
appStore.setTitle(title);
}
onMounted(() => {
fnLocale();
// 获取信息
fnGetProfile();
});