2015-12-25 11:56:25 +08:00
|
|
|
# Checkbox 组
|
2015-12-24 15:03:06 +08:00
|
|
|
|
|
|
|
- order: 3
|
|
|
|
|
2016-02-21 14:14:59 +08:00
|
|
|
方便的从数组生成 Checkbox 组。若需要 label 和 value 分离请直接使用 Checkbox。
|
2015-12-24 15:03:06 +08:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
|
|
|
import { Checkbox } from 'antd';
|
2015-12-24 15:13:23 +08:00
|
|
|
const CheckboxGroup = Checkbox.Group;
|
2015-12-24 15:03:06 +08:00
|
|
|
|
|
|
|
function onChange(checkedValues) {
|
|
|
|
console.log('checked = ', checkedValues);
|
|
|
|
}
|
|
|
|
|
2015-12-25 11:42:13 +08:00
|
|
|
ReactDOM.render(
|
|
|
|
<CheckboxGroup options={['Apple', 'Pear', 'Orange']} defaultValue={['Apple']} onChange={onChange} />
|
2015-12-29 12:08:58 +08:00
|
|
|
, mountNode);
|
2015-12-24 15:03:06 +08:00
|
|
|
````
|