const { getFieldProps } = this.props.form;
const { getFieldProps2 } = this.props.form2;
return(
<Form inline form={this.props.form} onSubmit={this.handleActivitySearch}>
...
<Input style={{}} type="text" placeholder="" {...getFieldProps('userID', {initialValue: '' })} />
</Form>
<Form inline form={this.props.form2} onSubmit={this.handleActivitySearch}>
<Input style={{}} type="text" placeholder="" {...getFieldProps2('userID', {initialValue: '' })} />
...
</Form>
);
这里怎么获取这两个表单的数据?上面的做法是被报错的,会提示getFieldProps2 未定义
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
const { getFieldProps } = this.props.form; 这句的意思是form中的getFieldProps方法,form和它的方法是固定的,因此并没有form2这个东西,也就没有getFieldProps2 。建议尝试一下getFieldProps = this.props.form.getFieldProps ,然后直接使用form={getFieldProps }。我也是初学,哈哈,有什么说得不对的告诉我,我改正哈
可以参考蚂蚁UI的form: http://ant.design/components/...,里面有form里面的方法介绍
我也遇到题主的问题了,最后解决方案是把每个表单单独用一个组件