diff --git a/src/components/SideBar/LeftSideBar.js b/src/components/SideBar/LeftSideBar.js
index 86fad4c..df28f6d 100644
--- a/src/components/SideBar/LeftSideBar.js
+++ b/src/components/SideBar/LeftSideBar.js
@@ -30,7 +30,7 @@ const getIcon = icon => {
return icon;
};
-export const getMeunMatchKeys = (flatMenu, path) => {
+export const getMenuMatchKeys = (flatMenu, path) => {
return flatMenu.filter(item => {
return pathToRegexp(item.path).test(path);
});
@@ -50,16 +50,16 @@ class LeftSideBar extends PureComponent {
}
componentDidUpdate(prevProps, prevState) {
- if (
- !isEqual(
- this.props.currentMenu.parentPath,
- prevProps.currentMenu.parentPath
- )
- ) {
- this.setState({
- openKeys: this.props.currentMenu.parentPath || []
- });
- }
+ //if (
+ // !isEqual(
+ // String(this.props.currentMenu.parentPath),
+ // String(prevProps.currentMenu.parentPath)
+ // )
+ //) {
+ // this.setState({
+ // openKeys: this.props.currentMenu.parentPath || []
+ // });
+ //}
}
/**
@@ -86,7 +86,7 @@ class LeftSideBar extends PureComponent {
to={itemPath}
target={target}
replace={itemPath === this.props.location.pathname}
- onClick={isMobile ? onCollapse : () => {}}
+ onClick={isMobile ? onCollapse : () => { }}
>
{icon}
{name}
@@ -110,8 +110,8 @@ class LeftSideBar extends PureComponent {
{item.name}
) : (
- item.name
- )
+ item.name
+ )
}
key={item.path}
>
@@ -155,7 +155,7 @@ class LeftSideBar extends PureComponent {
// Get the currently selected menu
getSelectedMenuKeys = () => {
const pathname = this.props.location.pathname;
- const selectMenu = getMeunMatchKeys(this.props.flatMenu, pathname)[0];
+ const selectMenu = getMenuMatchKeys(this.props.flatMenu, pathname)[0];
return selectMenu ? [selectMenu.path] : [];
};
@@ -202,12 +202,12 @@ class LeftSideBar extends PureComponent {
// Don't show popup menu when it is been collapsed
const menuProps = collapsed
? {
- selectedKeys
- }
+ selectedKeys
+ }
: {
- openKeys,
- selectedKeys
- };
+ openKeys,
+ selectedKeys
+ };
const siderBar = (
) : (
- siderBar
- );
+ siderBar
+ );
}
}
diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js
index 6739d1a..0256810 100644
--- a/src/layouts/BasicLayout.js
+++ b/src/layouts/BasicLayout.js
@@ -49,7 +49,7 @@ export default class BasicLayout extends React.PureComponent {
collapsedRightSide: true, // 右边栏开关
theme, // 皮肤设置
user,
- currentMenu: {},
+ currentMenu: this.getCurrentMenu(this.props),
isMobile: false
};
@@ -244,35 +244,35 @@ export default class BasicLayout extends React.PureComponent {
{theme.layout.indexOf('tabLayout') >= 0 ? (
) : (
-
-
-
-
-
-
-
- {childRoutes}
-
-
-
-
-
-
- )}
+
+
+
+
+
+
+
+ {childRoutes}
+
+
+
+
+
+
+ )}