2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 6
|
|
|
|
title: 位置
|
|
|
|
---
|
2015-12-16 11:53:52 +08:00
|
|
|
|
|
|
|
有四个位置,`tabPosition="left|right|top|bottom"`。
|
|
|
|
|
|
|
|
````jsx
|
|
|
|
import { Tabs, Select } from 'antd';
|
|
|
|
const TabPane = Tabs.TabPane;
|
|
|
|
const Option = Select.Option;
|
|
|
|
|
|
|
|
const Demo = React.createClass({
|
|
|
|
getInitialState() {
|
|
|
|
return {
|
|
|
|
tabPosition: 'top',
|
|
|
|
};
|
|
|
|
},
|
|
|
|
changeTabPosition(tabPosition) {
|
|
|
|
this.setState({ tabPosition });
|
|
|
|
},
|
|
|
|
render() {
|
2016-01-07 16:29:12 +08:00
|
|
|
return (
|
|
|
|
<div>
|
2016-01-27 16:44:50 +08:00
|
|
|
<div style={{ marginBottom: 16 }}>
|
2016-01-07 16:29:12 +08:00
|
|
|
页签位置:
|
|
|
|
<Select value={this.state.tabPosition} onChange={this.changeTabPosition}
|
2016-01-08 14:41:05 +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}>
|
|
|
|
<TabPane tab="选项卡一" key="1">选项卡一内容</TabPane>
|
|
|
|
<TabPane tab="选项卡二" key="2">选项卡二内容</TabPane>
|
|
|
|
<TabPane tab="选项卡三" key="3">选项卡三内容</TabPane>
|
|
|
|
</Tabs>
|
2015-12-16 11:53:52 +08:00
|
|
|
</div>
|
2016-01-07 16:29:12 +08:00
|
|
|
);
|
2016-05-11 09:32:33 +08:00
|
|
|
},
|
2015-12-16 11:53:52 +08:00
|
|
|
});
|
|
|
|
|
2015-12-29 12:08:58 +08:00
|
|
|
ReactDOM.render(<Demo />, mountNode);
|
2015-12-16 11:53:52 +08:00
|
|
|
````
|