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 {
const { routerData, location } = this.props;
const { pathname } = location;
let title = 'Ant Design Pro';
let currRouterData = null;
// match params path
const currRouterData = (Object.entries(routerData).find(([key]) =>
pathToRegexp(key).test(pathname)
) || [])[1];
for (key in Object.keys(routerData)) {
if (pathToRegexp(key).test(pathname)) {
currRouterData = routerData[key];
break
}
}
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