Commit 4903acb4 authored by 杨伟荣's avatar 杨伟荣 Committed by 陈帅

修复侧边栏菜单不能动态显示的问题

parent e3cb9b2d
...@@ -196,7 +196,8 @@ export default class SiderMenu extends PureComponent { ...@@ -196,7 +196,8 @@ export default class SiderMenu extends PureComponent {
}; };
isMainMenu = key => { isMainMenu = key => {
return this.props.menuData.some(item => key && (item.key === key || item.path === key)); const { menuData } = this.props;
return menuData.some(item => key && (item.key === key || item.path === key));
}; };
handleOpenChange = openKeys => { handleOpenChange = openKeys => {
...@@ -208,7 +209,7 @@ export default class SiderMenu extends PureComponent { ...@@ -208,7 +209,7 @@ export default class SiderMenu extends PureComponent {
}; };
render() { render() {
const { logo, collapsed, onCollapse } = this.props; const { logo, menuData, collapsed, onCollapse } = this.props;
const { openKeys } = this.state; const { openKeys } = this.state;
// Don't show popup menu when it is been collapsed // Don't show popup menu when it is been collapsed
const menuProps = collapsed const menuProps = collapsed
...@@ -246,7 +247,7 @@ export default class SiderMenu extends PureComponent { ...@@ -246,7 +247,7 @@ export default class SiderMenu extends PureComponent {
selectedKeys={selectedKeys} selectedKeys={selectedKeys}
style={{ padding: '16px 0', width: '100%' }} style={{ padding: '16px 0', width: '100%' }}
> >
{this.getNavMenuItems(this.props.menuData)} {this.getNavMenuItems(menuData)}
</Menu> </Menu>
</Sider> </Sider>
); );
......
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