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

find

parent 1f4b5bbf
......@@ -132,15 +132,10 @@ 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
Object.keys(routerData).some(key => {
if (pathToRegexp(key).test(pathname)) {
currRouterData = routerData[key];
return true;
}
return false;
});
const currRouterData = (Object.entries(routerData).find(([key]) =>
pathToRegexp(key).test(pathname)
) || [])[1];
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