jim 7 лет назад
Родитель
Сommit
63fcc3d979
3 измененных файлов с 8 добавлено и 4 удалено
  1. 1 0
      .gitignore
  2. 5 3
      src/components/PageHeader/index.js
  3. 2 1
      src/routes/Forms/StepForm/index.js

+ 1 - 0
.gitignore

@@ -21,3 +21,4 @@ yarn.lock
 package-lock.json
 *bak
 jsconfig.json
+.vscode/settings.json

+ 5 - 3
src/components/PageHeader/index.js

@@ -34,10 +34,12 @@ export default class PageHeader extends PureComponent {
   componentDidMount() {
     this.getBreadcrumbDom();
   }
-  componentWillReceiveProps() {
-    this.getBreadcrumbDom();
-  }
 
+  componentDidUpdate(preProps) {
+    if (preProps.tabActiveKey !== this.props.tabActiveKey) {
+      this.getBreadcrumbDom();
+    }
+  }
   onChange = key => {
     if (this.props.onTabChange) {
       this.props.onTabChange(key);

+ 2 - 1
src/routes/Forms/StepForm/index.js

@@ -25,10 +25,11 @@ export default class StepForm extends PureComponent {
     }
   }
   render() {
-    const { match, routerData } = this.props;
+    const { match, routerData, location } = this.props;
     return (
       <PageHeaderLayout
         title="分步表单"
+        tabActiveKey={location.pathname}
         content="将一个冗长或用户不熟悉的表单任务分成多个步骤,指导用户完成。"
       >
         <Card bordered={false}>