瀏覽代碼

fix #2177 if collapsed is true, you need to click twice to display

陈帅 7 年之前
父節點
當前提交
128c8ea25f
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      src/layouts/BasicLayout.js

+ 8 - 1
src/layouts/BasicLayout.js

@@ -106,8 +106,15 @@ class BasicLayout extends React.PureComponent {
     });
   }
 
-  componentDidUpdate() {
+  componentDidUpdate(preProps) {
+    // After changing to phone mode,
+    // if collapsed is true, you need to click twice to display
     this.breadcrumbNameMap = this.getBreadcrumbNameMap();
+    const { isMobile } = this.state;
+    const { collapsed } = this.props;
+    if (isMobile && !preProps.isMobile && !collapsed) {
+      this.handleMenuCollapse(false);
+    }
   }
 
   componentWillUnmount() {