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
|
|
|
|
|
2020-06-08 20:51:30 +08:00
|
|
|
有四个位置,`tabPosition="left|right|top|bottom"`。在移动端下,`left|right` 会自动切换成 `top`。
|
2015-12-16 11:53:52 +08:00
|
|
|
|
2016-08-03 10:39:20 +08:00
|
|
|
## en-US
|
|
|
|
|
2020-06-08 20:51:30 +08:00
|
|
|
Tab's position: left, right, top or bottom. Will auto switch to `top` in mobile.
|
2016-08-03 10:39:20 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```jsx
|
2020-11-05 15:37:33 +08:00
|
|
|
import { Tabs, Radio, Space } from 'antd';
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2019-05-27 21:32:45 +08:00
|
|
|
const { TabPane } = Tabs;
|
2015-12-16 11:53:52 +08:00
|
|
|
|
2017-02-19 22:07:45 +08:00
|
|
|
class Demo extends React.Component {
|
|
|
|
state = {
|
2020-11-05 15:37:33 +08:00
|
|
|
tabPosition: 'left',
|
2019-05-07 14:57:32 +08:00
|
|
|
};
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2020-11-05 15:37:33 +08:00
|
|
|
changeTabPosition = e => {
|
|
|
|
this.setState({ tabPosition: e.target.value });
|
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() {
|
2020-11-05 15:37:33 +08:00
|
|
|
const { tabPosition } = this.state;
|
2016-01-07 16:29:12 +08:00
|
|
|
return (
|
2020-11-05 15:37:33 +08:00
|
|
|
<>
|
|
|
|
<Space style={{ marginBottom: 24 }}>
|
|
|
|
Tab position:
|
|
|
|
<Radio.Group value={tabPosition} onChange={this.changeTabPosition}>
|
|
|
|
<Radio.Button value="top">top</Radio.Button>
|
|
|
|
<Radio.Button value="bottom">bottom</Radio.Button>
|
|
|
|
<Radio.Button value="left">left</Radio.Button>
|
|
|
|
<Radio.Button value="right">right</Radio.Button>
|
|
|
|
</Radio.Group>
|
2020-04-29 16:21:56 +08:00
|
|
|
</Space>
|
2020-11-05 15:37:33 +08:00
|
|
|
<Tabs tabPosition={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>
|
2020-11-05 15:37:33 +08:00
|
|
|
</>
|
2016-01-07 16:29:12 +08:00
|
|
|
);
|
2017-02-19 22:07:45 +08:00
|
|
|
}
|
|
|
|
}
|
2015-12-16 11:53:52 +08:00
|
|
|
|
2022-04-15 16:20:56 +08:00
|
|
|
export default Demo;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|