浏览代码

Fix default activeTabKey, close #563

afc163 8 年之前
父节点
当前提交
d2afa15e13
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8 2
      src/components/PageHeader/index.js

+ 8 - 2
src/components/PageHeader/index.js

@@ -126,6 +126,13 @@ export default class PageHeader extends PureComponent {
       tabDefaultValue = tabList.filter(item => item.default)[0] || tabList[0];
     }
 
+    const activeKeyProps = {
+      defaultActiveKey: tabDefaultValue && tabDefaultValue.key,
+    };
+    if (activeTabKey !== undefined) {
+      activeKeyProps.activeKey = activeTabKey;
+    }
+
     return (
       <div className={clsString}>
         {breadcrumb}
@@ -147,8 +154,7 @@ export default class PageHeader extends PureComponent {
           tabList.length && (
             <Tabs
               className={styles.tabs}
-              defaultActiveKey={(tabDefaultValue && tabDefaultValue.key)}
-              activeKey={activeTabKey}
+              {...activeKeyProps}
               onChange={this.onChange}
             >
               {