Commit 1f4b5bbf authored by Amumu's avatar Amumu Committed by 偏右

Break the loop and avoid being overwritten

首次匹配终止循环,提高性能并避免被二次匹配覆盖
parent ca48ba14
......@@ -134,10 +134,12 @@ export default class BasicLayout extends React.PureComponent {
let title = 'Ant Design Pro';
let currRouterData = null;
// match params path
Object.keys(routerData).forEach(key => {
Object.keys(routerData).some(key => {
if (pathToRegexp(key).test(pathname)) {
currRouterData = routerData[key];
return true;
}
return false;
});
if (currRouterData && currRouterData.name) {
title = `${currRouterData.name} - Ant Design Pro`;
......
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