Other methods for antd desgin getFieldDecorator to get input values

From.create ({})

< FormItem >
{getFieldDecorator ("name", {
rules: [{require: true}, message:" cannot be empty"]
})
(< Input type= "text" className= "input_width" placeholder= "Please enter content" >)}
/ / normally put a button here and then let the form form add an onsubmit to get it, but if this button button is not in form, how to get the input value? Ask the boss to show me a way
< / FormItem >

Mar.15,2021

you can get the form in the button's click event handler

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

of course you can also use


this.props.form.getFieldsValues

to get the value of the specified form

Menu