From 91e47a403eca120d935aa7f420eb092b31e51828 Mon Sep 17 00:00:00 2001 From: yoyo837 Date: Fri, 24 Aug 2018 18:40:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20#1995=20=E4=B8=AD=20?= =?UTF-8?q?=E4=B8=BA=E4=BA=86=E5=B0=B1=E8=BF=91=E6=98=BE=E7=A4=BAtitle?= =?UTF-8?q?=E8=80=8C=E5=AF=BC=E8=87=B4=E9=9D=A2=E5=8C=85=E5=B1=91=E5=9C=A8?= =?UTF-8?q?=E6=9C=AA=E9=85=8D=E7=BD=AE=E8=8F=9C=E5=8D=95=E7=9A=84=E5=AD=90?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=97=B6=E9=87=8D=E5=A4=8D=E5=A4=9A=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/router.js | 7 ++++++- src/components/PageHeader/index.js | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/common/router.js b/src/common/router.js index df247acd..269ed7a7 100644 --- a/src/common/router.js +++ b/src/common/router.js @@ -204,7 +204,11 @@ export const getRouterData = app => { Object.keys(routerConfig).forEach(path => { // Regular match item name // eg. router /user/:id === /user/chen - const menuKey = findMenuKey(menuData, path); + let menuKey = Object.keys(menuData).find(key => pathToRegexp(path).test(`${key}`)); + const inherited = menuKey == null; + if (menuKey == null) { + menuKey = findMenuKey(menuData, path); + } let menuItem = {}; // If menuKey is not empty if (menuKey) { @@ -219,6 +223,7 @@ export const getRouterData = app => { name: router.name || menuItem.name, authority: router.authority || menuItem.authority, hideInBreadcrumb: router.hideInBreadcrumb || menuItem.hideInBreadcrumb, + inherited, }; routerData[path] = router; }); diff --git a/src/components/PageHeader/index.js b/src/components/PageHeader/index.js index 7a602da0..df63c8d3 100644 --- a/src/components/PageHeader/index.js +++ b/src/components/PageHeader/index.js @@ -101,6 +101,9 @@ export default class PageHeader extends PureComponent { // Loop data mosaic routing const extraBreadcrumbItems = pathSnippets.map((url, index) => { const currentBreadcrumb = getBreadcrumb(breadcrumbNameMap, url); + if (currentBreadcrumb.inherited) { + return null; + } const isLinkable = index !== pathSnippets.length - 1 && currentBreadcrumb.component; return currentBreadcrumb.name && !currentBreadcrumb.hideInBreadcrumb ? ( -- GitLab