2016-03-31 09:40:55 +08:00
|
|
|
|
---
|
|
|
|
|
order: 6
|
2017-02-04 01:13:35 +08:00
|
|
|
|
title:
|
2016-08-23 14:15:34 +08:00
|
|
|
|
zh-CN: 位置
|
|
|
|
|
en-US: Position
|
2016-03-31 09:40:55 +08:00
|
|
|
|
---
|
2015-12-16 11:53:52 +08:00
|
|
|
|
|
2016-08-03 10:39:20 +08:00
|
|
|
|
## zh-CN
|
|
|
|
|
|
2015-12-16 11:53:52 +08:00
|
|
|
|
有四个位置,`tabPosition="left|right|top|bottom"`。
|
|
|
|
|
|
2016-08-03 10:39:20 +08:00
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
|
|
Tab's position: left, right, top or bottom.
|
|
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
|
```jsx
|
2015-12-16 11:53:52 +08:00
|
|
|
|
import { Tabs, Select } from 'antd';
|
2018-06-27 15:55:04 +08:00
|
|
|
|
|
2019-05-27 21:32:45 +08:00
|
|
|
|
const { TabPane } = Tabs;
|
|
|
|
|
const { Option } = Select;
|
2015-12-16 11:53:52 +08:00
|
|
|
|
|
2017-02-19 22:07:45 +08:00
|
|
|
|
class Demo extends React.Component {
|
|
|
|
|
state = {
|
|
|
|
|
tabPosition: 'top',
|
2019-05-07 14:57:32 +08:00
|
|
|
|
};
|
2018-06-27 15:55:04 +08:00
|
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
|
changeTabPosition = tabPosition => {
|
2015-12-16 11:53:52 +08:00
|
|
|
|
this.setState({ tabPosition });
|
2019-05-07 14:57:32 +08:00
|
|
|
|
};
|
2018-06-27 15:55:04 +08:00
|
|
|
|
|
2015-12-16 11:53:52 +08:00
|
|
|
|
render() {
|
2016-01-07 16:29:12 +08:00
|
|
|
|
return (
|
|
|
|
|
<div>
|
2016-01-27 16:44:50 +08:00
|
|
|
|
<div style={{ marginBottom: 16 }}>
|
2016-09-18 09:26:39 +08:00
|
|
|
|
Tab position:
|
2017-05-15 14:37:22 +08:00
|
|
|
|
<Select
|
|
|
|
|
value={this.state.tabPosition}
|
|
|
|
|
onChange={this.changeTabPosition}
|
2016-06-06 13:54:10 +08:00
|
|
|
|
dropdownMatchSelectWidth={false}
|
|
|
|
|
>
|
2016-01-07 16:29:12 +08:00
|
|
|
|
<Option value="top">top</Option>
|
|
|
|
|
<Option value="bottom">bottom</Option>
|
|
|
|
|
<Option value="left">left</Option>
|
|
|
|
|
<Option value="right">right</Option>
|
|
|
|
|
</Select>
|
|
|
|
|
</div>
|
|
|
|
|
<Tabs tabPosition={this.state.tabPosition}>
|
2019-05-07 14:57:32 +08:00
|
|
|
|
<TabPane tab="Tab 1" key="1">
|
|
|
|
|
Content of Tab 1
|
|
|
|
|
</TabPane>
|
|
|
|
|
<TabPane tab="Tab 2" key="2">
|
|
|
|
|
Content of Tab 2
|
|
|
|
|
</TabPane>
|
|
|
|
|
<TabPane tab="Tab 3" key="3">
|
|
|
|
|
Content of Tab 3
|
|
|
|
|
</TabPane>
|
2016-01-07 16:29:12 +08:00
|
|
|
|
</Tabs>
|
2015-12-16 11:53:52 +08:00
|
|
|
|
</div>
|
2016-01-07 16:29:12 +08:00
|
|
|
|
);
|
2017-02-19 22:07:45 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-12-16 11:53:52 +08:00
|
|
|
|
|
2015-12-29 12:08:58 +08:00
|
|
|
|
ReactDOM.render(<Demo />, mountNode);
|
2019-05-07 14:57:32 +08:00
|
|
|
|
```
|