From c7249558a6f6407ebf7419052407d30794e1210d Mon Sep 17 00:00:00 2001 From: "chen.home" <1147347984@qq.com> Date: Sat, 27 Aug 2022 23:10:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(header):=20=E4=BF=AE=E5=A4=8D=E9=9D=A2?= =?UTF-8?q?=E5=8C=85=E5=B1=91=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/components/header/Breadcrumb.vue | 5 +---- src/store/modules/route.ts | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/layouts/components/header/Breadcrumb.vue b/src/layouts/components/header/Breadcrumb.vue index b1c091d..edb2c58 100644 --- a/src/layouts/components/header/Breadcrumb.vue +++ b/src/layouts/components/header/Breadcrumb.vue @@ -17,10 +17,7 @@ const router = useRouter(); const routeStore = useRouteStore(); const { routerPush } = useAppRouter(); const routes = computed(() => { - return routeStore.createBreadcrumbFromRoutes( - (router.currentRoute.value.name as string) || '/', - routeStore.userRoutes, - ); + return routeStore.createBreadcrumbFromRoutes(router.currentRoute.value.name as string!, routeStore.userRoutes); }); diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 9cc0a9c..fd7d0a3 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -33,7 +33,7 @@ export const useRouteStore = defineStore('route-store', { router.removeRoute('appRoot'); }, /* 根据当前路由的name生成面包屑数据 */ - createBreadcrumbFromRoutes(routeName: string, userRoutes: AppRoute.Route[]) { + createBreadcrumbFromRoutes(routeName = '/', userRoutes: AppRoute.Route[]) { const path: AppRoute.Route[] = []; // 筛选所有包含目标的各级路由组合成一维数组 const getPathfromRoutes = (routeName: string, userRoutes: AppRoute.Route[]) => {