소스 검색

fix: 解决当 path 带有参数信息时,会导致权限判断失效 (#3087)

加上 router.path 为空的判断是因为我发现 routeData 会存在没有 path 的状况
Close: #3084
Robin 7 년 전
부모
커밋
268ea2bd1e
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/layouts/BasicLayout.js

+ 1 - 1
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);