Commit 54678ba6 authored by doudou's avatar doudou Committed by ι™ˆεΈ…

fixed submenu collapsed when refresh page (#3494)

parent 4b92d80b
...@@ -18,10 +18,14 @@ export default class SiderMenu extends PureComponent { ...@@ -18,10 +18,14 @@ export default class SiderMenu extends PureComponent {
} }
static getDerivedStateFromProps(props, state) { static getDerivedStateFromProps(props, state) {
const { pathname } = state; const { pathname, flatMenuKeysLen } = state;
if (props.location.pathname !== pathname) { if (
props.location.pathname !== pathname ||
props.flatMenuKeys.length !== flatMenuKeysLen
) {
return { return {
pathname: props.location.pathname, pathname: props.location.pathname,
flatMenuKeysLen: props.flatMenuKeys.length,
openKeys: getDefaultCollapsedSubMenus(props), openKeys: getDefaultCollapsedSubMenus(props),
}; };
} }
......
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