perf: 同步主分支代码

This commit is contained in:
xiaoxian521
2021-11-16 22:17:57 +08:00
parent 0f3d82a9b1
commit 4ef4768c65
16 changed files with 132 additions and 26 deletions

View File

@@ -7,11 +7,10 @@ import {
} from "vue-router";
import { RouteConfigs } from "/@/layout/types";
import { split, uniqBy } from "lodash-es";
import { i18n } from "/@/plugins/i18n";
import { transformI18n } from "../utils/i18n";
import { openLink } from "/@/utils/link";
import NProgress from "/@/utils/progress";
import { useTimeoutFn } from "@vueuse/core";
import { RouteConfigs } from "/@/layout/types";
import { storageSession, storageLocal } from "/@/utils/storage";
import { usePermissionStoreHook } from "/@/store/modules/permission";
@@ -201,10 +200,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 ? (document.title = t(to.meta.title)) : "";
if (!externalLink)
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

@@ -9,6 +9,7 @@ const errorRouter = {
icon: "Position",
title: "message.hserror",
showLink: true,
i18n: true,
rank: 7
},
children: [
@@ -18,6 +19,7 @@ const errorRouter = {
component: () => import("/@/views/error/401.vue"),
meta: {
title: "message.hsfourZeroOne",
i18n: true,
showLink: true
}
},
@@ -27,6 +29,7 @@ const errorRouter = {
component: () => import("/@/views/error/404.vue"),
meta: {
title: "message.hsfourZeroFour",
i18n: true,
showLink: true
}
}

View File

@@ -8,6 +8,7 @@ const externalLink = {
icon: "Link",
title: "message.externalLink",
showLink: true,
i18n: true,
rank: 190
},
children: [
@@ -16,6 +17,7 @@ const externalLink = {
meta: {
title: "message.externalLink",
showLink: true,
i18n: true,
rank: 191
}
}

View File

@@ -8,6 +8,7 @@ const homeRouter = {
meta: {
icon: "HomeFilled",
showLink: true,
i18n: true,
rank: 0
},
children: [
@@ -17,6 +18,7 @@ const homeRouter = {
component: () => import("/@/views/welcome.vue"),
meta: {
title: "message.hshome",
i18n: true,
showLink: true
}
}

View File

@@ -8,6 +8,7 @@ const remainingRouter = [
meta: {
title: "message.hslogin",
showLink: false,
i18n: true,
rank: 101
}
},
@@ -18,6 +19,7 @@ const remainingRouter = [
meta: {
icon: "HomeFilled",
title: "message.hshome",
i18n: true,
showLink: false,
rank: 104
},