2015-06-17 18:22:20 +08:00
|
|
|
# 按钮组合
|
2015-06-05 20:26:41 +08:00
|
|
|
|
2015-09-27 16:30:35 +08:00
|
|
|
- order: 5
|
2015-06-05 20:26:41 +08:00
|
|
|
|
2015-09-27 16:30:35 +08:00
|
|
|
可以将多个 `Button` 放入 `ButtonGroup` 的容器中。
|
2015-06-07 14:03:00 +08:00
|
|
|
|
2015-10-22 21:01:52 +08:00
|
|
|
通过设置 `size` 为 `large` `small` 分别把按钮组合设为大、小尺寸。若不设置 `size`,则尺寸为中。
|
2015-06-05 20:26:41 +08:00
|
|
|
|
|
|
|
---
|
|
|
|
|
2015-10-02 15:04:28 +08:00
|
|
|
````jsx
|
2015-09-27 16:30:35 +08:00
|
|
|
var Button = antd.Button;
|
|
|
|
var ButtonGroup = antd.ButtonGroup;
|
2015-10-02 15:04:28 +08:00
|
|
|
var Icon = antd.Icon;
|
|
|
|
|
2015-10-20 16:47:55 +08:00
|
|
|
ReactDOM.render(<div>
|
2015-06-08 12:32:09 +08:00
|
|
|
<h4>基本组合</h4>
|
2015-09-27 16:30:35 +08:00
|
|
|
<ButtonGroup>
|
|
|
|
<Button type="primary">确定</Button>
|
|
|
|
<Button type="primary">取消</Button>
|
|
|
|
</ButtonGroup>
|
|
|
|
<ButtonGroup>
|
|
|
|
<Button>左</Button>
|
|
|
|
<Button>中</Button>
|
|
|
|
<Button>右</Button>
|
|
|
|
</ButtonGroup>
|
|
|
|
<ButtonGroup>
|
|
|
|
<Button type="primary">左</Button>
|
|
|
|
<Button type="ghost">中</Button>
|
|
|
|
<Button type="ghost">中</Button>
|
|
|
|
<Button>右</Button>
|
|
|
|
</ButtonGroup>
|
2015-10-06 12:55:01 +08:00
|
|
|
|
2015-06-08 12:32:09 +08:00
|
|
|
<h4>带图标按钮组合 </h4>
|
2015-09-27 16:30:35 +08:00
|
|
|
<ButtonGroup>
|
|
|
|
<Button type="primary">
|
2015-10-02 15:04:28 +08:00
|
|
|
<Icon type="left" />
|
2015-09-27 16:30:35 +08:00
|
|
|
<span>后退</span>
|
|
|
|
</Button>
|
|
|
|
<Button type="primary">
|
|
|
|
前进
|
2015-10-02 15:04:28 +08:00
|
|
|
<Icon type="right" />
|
2015-09-27 16:30:35 +08:00
|
|
|
</Button>
|
|
|
|
</ButtonGroup>
|
|
|
|
<ButtonGroup>
|
|
|
|
<Button type="primary">
|
2015-10-02 15:04:28 +08:00
|
|
|
<Icon type="cloud" />
|
2015-09-27 16:30:35 +08:00
|
|
|
</Button>
|
|
|
|
<Button type="primary">
|
2015-10-02 15:04:28 +08:00
|
|
|
<Icon type="cloud-download" />
|
2015-09-27 16:30:35 +08:00
|
|
|
</Button>
|
|
|
|
</ButtonGroup>
|
2015-10-06 12:55:01 +08:00
|
|
|
|
2015-06-08 12:32:09 +08:00
|
|
|
<h4>多个组合</h4>
|
2015-09-27 16:30:35 +08:00
|
|
|
<ButtonGroup>
|
|
|
|
<Button type="ghost">1</Button>
|
|
|
|
<Button type="ghost">2</Button>
|
|
|
|
<Button type="ghost">3</Button>
|
|
|
|
<Button type="ghost">4</Button>
|
|
|
|
<Button type="ghost">
|
|
|
|
<span>前进</span>
|
2015-10-02 15:04:28 +08:00
|
|
|
<Icon type="right" />
|
2015-09-27 16:30:35 +08:00
|
|
|
</Button>
|
|
|
|
</ButtonGroup>
|
2015-10-06 12:55:01 +08:00
|
|
|
|
2015-06-08 12:32:09 +08:00
|
|
|
<h4>尺寸</h4>
|
2015-10-22 21:01:52 +08:00
|
|
|
<ButtonGroup size="large">
|
2015-09-27 16:30:35 +08:00
|
|
|
<Button type="ghost">大</Button>
|
|
|
|
<Button type="ghost">大</Button>
|
|
|
|
<Button type="ghost">大</Button>
|
|
|
|
</ButtonGroup>
|
|
|
|
<ButtonGroup>
|
|
|
|
<Button type="ghost">默认</Button>
|
|
|
|
<Button type="ghost">默认</Button>
|
|
|
|
<Button type="ghost">默认</Button>
|
|
|
|
</ButtonGroup>
|
2015-10-22 21:01:52 +08:00
|
|
|
<ButtonGroup size="small">
|
2015-09-27 16:30:35 +08:00
|
|
|
<Button type="ghost">小</Button>
|
|
|
|
<Button type="ghost">小</Button>
|
|
|
|
<Button type="ghost">小</Button>
|
|
|
|
</ButtonGroup>
|
2015-06-08 12:32:09 +08:00
|
|
|
</div>
|
2015-10-02 15:04:28 +08:00
|
|
|
, document.getElementById('components-button-demo-button-group'));
|
2015-06-08 12:32:09 +08:00
|
|
|
````
|
|
|
|
|
|
|
|
<style>
|
2015-06-15 19:33:39 +08:00
|
|
|
.nico-insert-code h4 {
|
2015-06-17 18:22:20 +08:00
|
|
|
margin: 8px 0;
|
2015-06-15 19:33:39 +08:00
|
|
|
font-size: 12px;
|
2015-06-17 18:22:20 +08:00
|
|
|
line-height: 12px;
|
2015-06-15 22:14:15 +08:00
|
|
|
font-weight: normal;
|
2015-06-15 19:33:39 +08:00
|
|
|
}
|
2015-06-08 12:32:09 +08:00
|
|
|
.nico-insert-code h4:first-child {
|
|
|
|
margin-top: 0;
|
|
|
|
}
|
2015-06-09 15:21:07 +08:00
|
|
|
.nico-insert-code .ant-btn {
|
2015-06-15 19:33:39 +08:00
|
|
|
margin-bottom: 8px;
|
2015-06-09 15:21:07 +08:00
|
|
|
}
|
2015-09-27 16:30:35 +08:00
|
|
|
#components-button-demo-button-group .ant-btn-group {
|
|
|
|
margin-right: 8px;
|
|
|
|
}
|
|
|
|
#components-button-demo-button-group .ant-btn {
|
|
|
|
margin-bottom: 12px;
|
2015-10-02 15:04:28 +08:00
|
|
|
}
|
2015-06-08 12:32:09 +08:00
|
|
|
</style>
|