Procházet zdrojové kódy

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

陈帅 před 7 roky
rodič
revize
128c8ea25f
1 změnil soubory, kde provedl 8 přidání a 1 odebrání
  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();
     this.breadcrumbNameMap = this.getBreadcrumbNameMap();
+    const { isMobile } = this.state;
+    const { collapsed } = this.props;
+    if (isMobile && !preProps.isMobile && !collapsed) {
+      this.handleMenuCollapse(false);
+    }
   }
   }
 
 
   componentWillUnmount() {
   componentWillUnmount() {