mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 03:29:39 +08:00
docs: add demo for valuePropName #1062
This commit is contained in:
parent
06591077d3
commit
353601ca0c
@ -7,13 +7,21 @@
|
||||
---
|
||||
|
||||
````jsx
|
||||
import { Select, Radio, Button, DatePicker, InputNumber, Form, Cascader } from 'antd';
|
||||
import { Select, Radio, Checkbox, Button, DatePicker, InputNumber, Form, Cascader } from 'antd';
|
||||
const Option = Select.Option;
|
||||
const RadioGroup = Radio.Group;
|
||||
const createForm = Form.create;
|
||||
const FormItem = Form.Item;
|
||||
|
||||
let Demo = React.createClass({
|
||||
componentDidMount() {
|
||||
this.props.form.setFieldsValue({
|
||||
eat: true,
|
||||
sleep: true,
|
||||
beat: true,
|
||||
});
|
||||
},
|
||||
|
||||
handleReset(e) {
|
||||
e.preventDefault();
|
||||
this.props.form.resetFields();
|
||||
@ -113,6 +121,22 @@ let Demo = React.createClass({
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="兴趣爱好:"
|
||||
labelCol={{ span: 7 }}
|
||||
wrapperCol={{ span: 12 }}
|
||||
help="Checkbox 必须设置 `valuePropName`">
|
||||
<Checkbox {...getFieldProps('eat', {
|
||||
valuePropName: 'checked',
|
||||
})} />吃饭饭
|
||||
<Checkbox {...getFieldProps('sleep', {
|
||||
valuePropName: 'checked',
|
||||
})} />睡觉觉
|
||||
<Checkbox {...getFieldProps('beat', {
|
||||
valuePropName: 'checked',
|
||||
})} />打豆豆
|
||||
</FormItem>
|
||||
|
||||
<FormItem
|
||||
label="生日:"
|
||||
labelCol={{ span: 7 }}
|
||||
|
Loading…
Reference in New Issue
Block a user