ant design of components using summary form

1. Create

@ Form.create () // write out of class

Can then be operated by this.props.from

 

Values ​​in the operation 2.form

(1) check

this.props.form.validateFields((err, values) => {

  console.log(values)
});

(2) add, change

this.props.form.setFieldsValue({id:1});

 

Note: You must have dom, such as:

<Form onSubmit={this.handleSubmit}>
<FormItem style={{ display:'none' }}>
{form.getFieldDecorator('id')(<Input/>)}
</FormItem>

<Form> 

after

In order to

this.props.form.validateFields((err, values) => {
});

Inside to get the id by values.id

If only this.props.form.setFieldsValue ({id: 1}); while no corresponding dom, you can not obtain values.id

 

Guess you like

Origin www.cnblogs.com/spirker/p/11314679.html