From 268ea2bd1e6180048fd97e2376daf3431836c585 Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 7 Dec 2018 15:10:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=BD=93=20path=20?= =?UTF-8?q?=E5=B8=A6=E6=9C=89=E5=8F=82=E6=95=B0=E4=BF=A1=E6=81=AF=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E5=AF=BC=E8=87=B4=E6=9D=83=E9=99=90=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E5=A4=B1=E6=95=88=20(#3087)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 加上 router.path 为空的判断是因为我发现 routeData 会存在没有 path 的状况 Close: #3084 --- src/layouts/BasicLayout.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 7cd5be5b..dba40f34 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -100,7 +100,7 @@ class BasicLayout extends React.PureComponent { let routeAuthority = ['noAuthority']; const getAuthority = (key, routes) => { routes.map(route => { - if (route.path === key) { + if (route.path && pathToRegexp(route.path).test(key)) { routeAuthority = route.authority; } else if (route.routes) { routeAuthority = getAuthority(key, route.routes); -- GitLab