mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 13:09:40 +08:00
Fix some style and react key problems
This commit is contained in:
parent
349d03e384
commit
b115f000f9
@ -20,9 +20,9 @@ function newTabPane() {
|
||||
|
||||
ReactDOM.render(
|
||||
<Tabs onChange={callback} type="card" editable newTabPane={newTabPane}>
|
||||
<TabPane tab="卡一" key="1">选项卡一内容</TabPane>
|
||||
<TabPane tab="卡二" key="2">选项卡二内容</TabPane>
|
||||
<TabPane tab="卡三" key="3">选项卡三内容</TabPane>
|
||||
<TabPane tab="选项卡" key="1">选项卡一内容</TabPane>
|
||||
<TabPane tab="选项卡" key="2">选项卡二内容</TabPane>
|
||||
<TabPane tab="选项卡" key="3">选项卡三内容</TabPane>
|
||||
</Tabs>
|
||||
, document.getElementById('components-tabs-demo-new-and-close'));
|
||||
````
|
||||
|
@ -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 = [
|
||||
<Icon type="plus" className={prefixCls + '-new-tab'} onClick={this.createNewTab} />,
|
||||
tabBarExtraContent,
|
||||
];
|
||||
tabBarExtraContent = <span>
|
||||
<Icon type="plus" className={prefixCls + '-new-tab'} onClick={this.createNewTab} />
|
||||
{tabBarExtraContent}
|
||||
</span>;
|
||||
}
|
||||
// Wrap the extra content
|
||||
tabBarExtraContent = <div className={prefixCls + '-extra-content'}>
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user