Commit 837b8c23 authored by 陈小聪's avatar 陈小聪 Committed by 陈帅

route authority attribute behavior no use while (#3522)

* route authority attribute behavior no use while
parent 65e822ea
......@@ -90,29 +90,27 @@ class BasicLayout extends React.Component {
getRouteAuthority = (pathname, routeData) => {
const routes = routeData.slice(); // clone
let authorities;
while (routes.length > 0) {
const route = routes.shift();
const getAuthority = (routeDatas, path) => {
let authorities;
routeDatas.forEach(route => {
// check partial route
if (pathToRegexp(`${route.path}(.*)`).test(pathname)) {
if (pathToRegexp(`${route.path}(.*)`).test(path)) {
if (route.authority) {
authorities = route.authority;
}
// is exact route?
if (pathToRegexp(route.path).test(pathname)) {
break;
}
if (route.routes) {
route.routes.forEach(r => routes.push(r));
}
if (!pathToRegexp(route.path).test(path) && route.routes) {
authorities = getAuthority(route.routes, path);
}
}
});
return authorities;
};
return getAuthority(routes, pathname);
};
getPageTitle = (pathname, breadcrumbNameMap) => {
const currRouterData = this.matchParamsPath(pathname, breadcrumbNameMap);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment