From 27fb983d7263592283bf1e06bdae8f329d5fa373 Mon Sep 17 00:00:00 2001 From: hooray <304327508@qq.com> Date: Fri, 8 Jul 2022 03:37:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9D=A2=E5=8C=85=E5=B1=91?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E5=B1=95=E7=A4=BAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/route.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/store/modules/route.js b/src/store/modules/route.js index 4e899ea8..a7d16515 100644 --- a/src/store/modules/route.js +++ b/src/store/modules/route.js @@ -73,8 +73,9 @@ function flatAsyncRoutesRecursive(routes, breadcrumb, baseUrl) { routes.forEach(route => { if (route.children) { let childrenBaseUrl = resolveRoutePath(baseUrl, route.path) + let tmpBreadcrumb = deepClone(breadcrumb) if (route.meta.breadcrumb !== false) { - breadcrumb.push({ + tmpBreadcrumb.push({ path: childrenBaseUrl, title: route.meta.title, hide: !route.meta.breadcrumb && route.meta.breadcrumb === false @@ -82,10 +83,10 @@ function flatAsyncRoutesRecursive(routes, breadcrumb, baseUrl) { } let tmpRoute = deepClone(route) tmpRoute.path = childrenBaseUrl - tmpRoute.meta.breadcrumbNeste = deepClone(breadcrumb) + tmpRoute.meta.breadcrumbNeste = tmpBreadcrumb delete tmpRoute.children res.push(tmpRoute) - let childrenRoutes = flatAsyncRoutesRecursive(route.children, breadcrumb, childrenBaseUrl) + let childrenRoutes = flatAsyncRoutesRecursive(route.children, tmpBreadcrumb, childrenBaseUrl) childrenRoutes.map(item => { // 如果 path 一样则覆盖,因为子路由的 path 可能设置为空,导致和父路由一样,直接注册会提示路由重复 if (res.some(v => v.path == item.path)) {