mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 19:19:26 +08:00
Fix inlineCollapsed menu when submenu is opened
close #7524 close #7514 ref #7063
This commit is contained in:
parent
2feef3358c
commit
35fc427630
@ -99,20 +99,21 @@ export default class Menu extends React.Component<MenuProps, any> {
|
||||
nextProps.mode !== 'inline') {
|
||||
this.switchModeFromInline = true;
|
||||
}
|
||||
if ('openKeys' in nextProps) {
|
||||
this.setState({ openKeys: nextProps.openKeys });
|
||||
return;
|
||||
}
|
||||
if ((nextProps.inlineCollapsed && !this.props.inlineCollapsed) ||
|
||||
(nextContext.siderCollapsed && !this.context.siderCollapsed)) {
|
||||
this.switchModeFromInline = !!this.state.openKeys.length;
|
||||
this.inlineOpenKeys = this.state.openKeys;
|
||||
this.handleOpenChange([]);
|
||||
this.setState({ openKeys: [] });
|
||||
}
|
||||
if ((!nextProps.inlineCollapsed && this.props.inlineCollapsed) ||
|
||||
(!nextContext.siderCollapsed && this.context.siderCollapsed)) {
|
||||
this.handleOpenChange(this.inlineOpenKeys);
|
||||
this.setState({ openKeys: this.inlineOpenKeys });
|
||||
this.inlineOpenKeys = [];
|
||||
}
|
||||
if ('openKeys' in nextProps) {
|
||||
this.setState({ openKeys: nextProps.openKeys });
|
||||
}
|
||||
}
|
||||
handleClick = (e) => {
|
||||
this.handleOpenChange([]);
|
||||
|
Loading…
Reference in New Issue
Block a user