fix: i18n

This commit is contained in:
xiaoxian521 2021-11-16 13:49:24 +08:00
parent f0a5f02588
commit 35f2f9e93f
2 changed files with 10 additions and 8 deletions

View File

@ -208,14 +208,15 @@ router.beforeEach((to, _from, next) => {
const name = storageSession.getItem("info");
NProgress.start();
const externalLink = to?.redirectedFrom?.fullPath;
// @ts-ignore
// const { t } = i18n.global;
// @ts-ignore
if (!externalLink)
to.meta.title
? // @ts-ignore
(document.title = transformI18n(to.meta.title, to.meta.i18n))
to.matched.some(item => {
item.meta.title
? (document.title = transformI18n(
item.meta.title as string,
item.meta?.i18n as boolean
))
: "";
});
if (name) {
if (_from?.name) {
// 如果路由包含http 则是超链接 反之是普通路由

View File

@ -1,11 +1,12 @@
import { i18n } from "../plugins/i18n";
/**
*
* @param message message
* @param isI18n true,,this
* @returns message
*/
export function transformI18n(message = "", isI18n: Boolean = false) {
export function transformI18n(message = "", isI18n = false) {
if (!message) {
return "";
}