diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index aab2aaff68ef97647640a20863ac578524c34812..fb8f1a769dbe89710dcfe5126a8ae30257481910 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -51,7 +51,6 @@ export const getMenuMatchKeys = (flatMenuKeys, paths) => export default class SiderMenu extends PureComponent { constructor(props) { super(props); - this.menus = props.menuData; this.flatMenuKeys = getFlatMenuKeys(props.menuData); this.state = { openKeys: this.getDefaultCollapsedSubMenus(props), @@ -197,7 +196,7 @@ export default class SiderMenu extends PureComponent { }; isMainMenu = key => { - return this.menus.some(item => key && (item.key === key || item.path === key)); + return this.props.menuData.some(item => key && (item.key === key || item.path === key)); }; handleOpenChange = openKeys => { @@ -247,7 +246,7 @@ export default class SiderMenu extends PureComponent { selectedKeys={selectedKeys} style={{ padding: '16px 0', width: '100%' }} > - {this.getNavMenuItems(this.menus)} + {this.getNavMenuItems(this.props.menuData)} );