Browse Source

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

加上 router.path 为空的判断是因为我发现 routeData 会存在没有 path 的状况
Close: #3084
pull/3092/head
Robin 7 years ago
committed by 陈小聪
parent
commit
268ea2bd1e
  1. 2
      src/layouts/BasicLayout.js

2
src/layouts/BasicLayout.js

@ -100,7 +100,7 @@ class BasicLayout extends React.PureComponent {
let routeAuthority = ['noAuthority']; let routeAuthority = ['noAuthority'];
const getAuthority = (key, routes) => { const getAuthority = (key, routes) => {
routes.map(route => { routes.map(route => {
if (route.path === key) { if (route.path && pathToRegexp(route.path).test(key)) {
routeAuthority = route.authority; routeAuthority = route.authority;
} else if (route.routes) { } else if (route.routes) {
routeAuthority = getAuthority(key, route.routes); routeAuthority = getAuthority(key, route.routes);

Loading…
Cancel
Save