diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 84ec4e620940b3ffea4404d9ac3e5ac6dca99a0f..47fd8782cd3363d9edcf806e561ba1b1e39dda19 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -206,7 +206,7 @@ class BasicLayout extends React.PureComponent { handleOpenChange = (openKeys) => { const lastOpenKey = openKeys[openKeys.length - 1]; const isMainMenu = this.menus.some( - item => (item.key === lastOpenKey || item.path === lastOpenKey) + item => lastOpenKey && (item.key === lastOpenKey || item.path === lastOpenKey) ); this.setState({ openKeys: isMainMenu ? [lastOpenKey] : [...openKeys],