diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 781d6dbd6213c93f8f147a8c892105d20c9d7862..cfdfa2774c8a9529b7017a28f2e7805b23ed799d 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -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`; }