Commit 77eac16e authored by valleykid's avatar valleykid Committed by 偏右

Fixed issue#124 (#125)

Fix submenu cannot open
parent 7cc62e5f
...@@ -187,9 +187,12 @@ class BasicLayout extends React.PureComponent { ...@@ -187,9 +187,12 @@ class BasicLayout extends React.PureComponent {
return groupBy(newNotices, 'type'); return groupBy(newNotices, 'type');
} }
handleOpenChange = (openKeys) => { handleOpenChange = (openKeys) => {
const latestOpenKey = openKeys.find(key => this.state.openKeys.indexOf(key) === -1); const lastOpenKey = openKeys[openKeys.length - 1];
const isMainMenu = this.menus.some(
item => (item.key === lastOpenKey || item.path === lastOpenKey)
);
this.setState({ this.setState({
openKeys: latestOpenKey ? [latestOpenKey] : [], openKeys: isMainMenu ? [lastOpenKey] : [...openKeys],
}); });
} }
toggle = () => { toggle = () => {
......
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