mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-03 13:44:47 +08:00
@@ -6,6 +6,7 @@ import { split, findIndex } from "lodash-es";
|
||||
import { transformI18n } from "/@/plugins/i18n";
|
||||
import remainingRouter from "./modules/remaining";
|
||||
import { storageSession } from "/@/utils/storage";
|
||||
import { Title } from "../../public/serverConfig.json";
|
||||
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
|
||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||
import { Router, RouteMeta, createRouter, RouteRecordName } from "vue-router";
|
||||
@@ -54,12 +55,13 @@ router.beforeEach((to: toRouteType, _from, next) => {
|
||||
const externalLink = to?.redirectedFrom?.fullPath;
|
||||
if (!externalLink)
|
||||
to.matched.some(item => {
|
||||
item.meta.title
|
||||
? (document.title = transformI18n(
|
||||
item.meta.title as string,
|
||||
item.meta?.i18n as boolean
|
||||
))
|
||||
: "";
|
||||
if (!item.meta.title) return "";
|
||||
if (Title)
|
||||
document.title = `${transformI18n(
|
||||
item.meta.title,
|
||||
item.meta?.i18n
|
||||
)} | ${Title}`;
|
||||
else document.title = transformI18n(item.meta.title, item.meta?.i18n);
|
||||
});
|
||||
if (name) {
|
||||
if (_from?.name) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
formatTwoStageRoutes,
|
||||
formatFlatteningRoutes
|
||||
} from "../utils";
|
||||
import { buildHierarchyTree } from "/@/utils/tree";
|
||||
|
||||
// 原始静态路由(未做任何处理)
|
||||
const routes = [
|
||||
@@ -32,7 +33,7 @@ const routes = [
|
||||
|
||||
// 导出处理后的静态路由(三级及以上的路由全部拍成二级)
|
||||
export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
|
||||
formatFlatteningRoutes(ascending(routes))
|
||||
formatFlatteningRoutes(buildHierarchyTree(ascending(routes)))
|
||||
);
|
||||
|
||||
// 用于渲染菜单,保持原始层级
|
||||
|
||||
Reference in New Issue
Block a user