react 报错:TypeError: Cannot read property ‘getFieldDecorator’ of undefined 解决方法:在class前添加 @Form.create() 即可 例如: @Form.create() class myComponent ...
我们会直接 const getFieldDecorator this.props.form 直接使用getFieldDecorator 会报错 Cannot read property getFieldDecorator of undefined 后来查找看了下原因为 使用getFieldDecorator需要导出form组件 export default Form.create 于是就ojbk了 ...
2020-09-08 15:40 0 1164 推荐指数:
react 报错:TypeError: Cannot read property ‘getFieldDecorator’ of undefined 解决方法:在class前添加 @Form.create() 即可 例如: @Form.create() class myComponent ...
可能是因为formItem里放了caccade级联 这个时候直接写就好 不用在里面校验 ...
之前使用antd的ui表单,却没发现这么好用的用法,推荐给大家 使用getFieldDecorator ,因为是antd的form的属性,所以需要导出form组件,export default Form.create()(FormLogin); 效果: 可通过 ...
1)getFieldDecorator是一个方法,这个方法接收两个参数,第一个是表单的字段对象,第二个是验证规则。这个方法本身返回一个方法,需要将需要获取值的标签包裹进去。 const formItemLayout = { labelCol ...
单封装 const { getFieldDecorator } = this.props.form; ...
将会自带 this.props.form 属性,通过解构赋值将 form 解构出来 ...
这里使用了props.form.getFieldDecorator(id,{选择操作})方法来包装一个Input输入框组件,传入的第一个参数表示这个字段的Id,第二个参数是一个配置对象,这里设置了表单控件的校验规则rules。 问题:填写Form表单时会发报 Warning ...
后台管理系统常用到表单的增删改,这里也做了个封装 例如:user/index.js ETable/index.js ETable/index.scss ...