Commit 585ca55c authored by Ez-Z's avatar Ez-Z Committed by 偏右

fix: reload menu open question

 collapsed 为false时,刷新后菜单的openKeys为[]时,导致菜单不展开的问题
parent 3c97e964
...@@ -126,6 +126,7 @@ export default class BaseMenu extends PureComponent { ...@@ -126,6 +126,7 @@ export default class BaseMenu extends PureComponent {
mode, mode,
location: { pathname }, location: { pathname },
className, className,
collapsed,
} = this.props; } = this.props;
// if pathname can't match, use the nearest parent's key // if pathname can't match, use the nearest parent's key
let selectedKeys = this.getSelectedMenuKeys(pathname); let selectedKeys = this.getSelectedMenuKeys(pathname);
...@@ -133,9 +134,9 @@ export default class BaseMenu extends PureComponent { ...@@ -133,9 +134,9 @@ export default class BaseMenu extends PureComponent {
selectedKeys = [openKeys[openKeys.length - 1]]; selectedKeys = [openKeys[openKeys.length - 1]];
} }
let props = {}; let props = {};
if (openKeys) { if (openKeys && !collapsed) {
props = { props = {
openKeys, openKeys: openKeys.length === 0 ? [...selectedKeys] : openKeys,
}; };
} }
const { handleOpenChange, style, menuData } = this.props; const { handleOpenChange, style, menuData } = this.props;
......
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