diff --git a/components/tabs/demo/new-and-close.md b/components/tabs/demo/new-and-close.md index dcaf363694..ff93af63a2 100644 --- a/components/tabs/demo/new-and-close.md +++ b/components/tabs/demo/new-and-close.md @@ -20,9 +20,9 @@ function newTabPane() { ReactDOM.render( - 选项卡一内容 - 选项卡二内容 - 选项卡三内容 + 选项卡一内容 + 选项卡二内容 + 选项卡三内容 , document.getElementById('components-tabs-demo-new-and-close')); ```` diff --git a/components/tabs/index.jsx b/components/tabs/index.jsx index bd25820a42..e0763339f9 100644 --- a/components/tabs/index.jsx +++ b/components/tabs/index.jsx @@ -53,7 +53,9 @@ class AntTabs extends React.Component { } }); if (activeKey === key) { - activeKey = tabs[foundIndex - 1].key; + foundIndex = foundIndex - 1; + foundIndex = foundIndex >= 0 ? foundIndex : 0; + activeKey = tabs[foundIndex].key; } this.setState({ tabs, @@ -94,10 +96,10 @@ class AntTabs extends React.Component { children = this.state.tabs; } // Add new tab handler - tabBarExtraContent = [ - , - tabBarExtraContent, - ]; + tabBarExtraContent = + + {tabBarExtraContent} + ; } // Wrap the extra content tabBarExtraContent =
diff --git a/style/components/tabs.less b/style/components/tabs.less index 5393f52549..2270429915 100644 --- a/style/components/tabs.less +++ b/style/components/tabs.less @@ -397,6 +397,7 @@ margin-right: 0; margin-left: 4px; font-size: 12px; + width: 12px; color: #999; transition: color 0.3s ease; &:hover { @@ -417,6 +418,7 @@ border-radius: 3px; border: 1px solid @border-color-base; font-size: 12px; + .iconfont-size-under-12px(10px); transition: color 0.3s ease; &:hover { color: @primary-color;