<Form.Item>
{
getFieldDecorator('agreement', {
valuePropName: 'checked',
})(<Checkbox> 设为默认</Checkbox>)
}
</Form.Item>
使用类式组件 会报错 'getFieldDecorator' is not defined
查了些资料 const {getFieldDecorator} = this.props.form; 这个写在return上也报错
Contacts = Form.create({})(Contacts); 报的错好像是版本不对
在antd v4.x版本中,已移除Form.create() ,表单现在有它自己的数据范围,你不再需要getFieldDecorator了。直接使用Form.Item 即可。
官方demo