From a4a691de3e55a2d7634d0f231d1b333da5c09ffd Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Tue, 23 May 2023 20:43:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E9=87=8D=E5=AE=9A=E5=90=91=E9=80=A0=E6=88=90?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E9=A1=B5=E5=87=BA=E7=8E=B0=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.ts | 23 +++++++++++++++++------ src/router/modules/components.ts | 2 +- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index 2aed223e8..66ac4355c 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -23,7 +23,7 @@ import { formatFlatteningRoutes } from "./utils"; import { buildHierarchyTree } from "@/utils/tree"; -import { isUrl, openLink, storageSession } from "@pureadmin/utils"; +import { isUrl, openLink, storageSession, isAllEmpty } from "@pureadmin/utils"; import remainingRouter from "./modules/remaining"; @@ -158,11 +158,22 @@ router.beforeEach((to: toRouteType, _from, next) => { getTopMenu(true); // query、params模式路由传参数的标签页不在此处处理 if (route && route.meta?.title) { - useMultiTagsStoreHook().handleTags("push", { - path: route.path, - name: route.name, - meta: route.meta - }); + if (isAllEmpty(route.parentId) && route.meta?.backstage) { + // 此处为动态顶级路由(目录) + const { path, name, meta } = route.children[0]; + useMultiTagsStoreHook().handleTags("push", { + path, + name, + meta + }); + } else { + const { path, name, meta } = route; + useMultiTagsStoreHook().handleTags("push", { + path, + name, + meta + }); + } } } router.push(to.fullPath); diff --git a/src/router/modules/components.ts b/src/router/modules/components.ts index 44a068a91..8958d3c92 100644 --- a/src/router/modules/components.ts +++ b/src/router/modules/components.ts @@ -3,7 +3,7 @@ import { components } from "@/router/enums"; export default { path: "/components", - redirect: "/components/video", + redirect: "/components/dialog", meta: { icon: "menu", title: $t("menus.hscomponents"),