From e3cb9b2d50aade2e03a804e550db2c02eae08cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E4=BC=9F=E8=8D=A3?= Date: Mon, 16 Jul 2018 14:31:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BE=A7=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E4=B8=8D=E8=83=BD=E5=8A=A8=E6=80=81=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SiderMenu/SiderMenu.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index aab2aaff..fb8f1a76 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)} ); -- GitLab