Commit 89245734 authored by yoyo837's avatar yoyo837 Committed by 偏右

for in

parent a2d9a578
...@@ -132,10 +132,14 @@ export default class BasicLayout extends React.PureComponent { ...@@ -132,10 +132,14 @@ export default class BasicLayout extends React.PureComponent {
const { routerData, location } = this.props; const { routerData, location } = this.props;
const { pathname } = location; const { pathname } = location;
let title = 'Ant Design Pro'; let title = 'Ant Design Pro';
let currRouterData = null;
// match params path // match params path
const currRouterData = (Object.entries(routerData).find(([key]) => for (key in Object.keys(routerData)) {
pathToRegexp(key).test(pathname) if (pathToRegexp(key).test(pathname)) {
) || [])[1]; currRouterData = routerData[key];
break
}
}
if (currRouterData && currRouterData.name) { if (currRouterData && currRouterData.name) {
title = `${currRouterData.name} - Ant Design Pro`; 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