简体   繁体   English

不能使用 Ant 的 setFieldsValue class 组件的设计形式

[英]cannot use setFieldsValue of Ant Design Form of class component

I'm trying to use setFieldsValue to fill value in form.我正在尝试使用 setFieldsValue 在表单中填写值。 Although I initialized form.ref, I can't use this.formRef.current.setFieldsValue to set value to a field.尽管我初始化了 form.ref,但我不能使用 this.formRef.current.setFieldsValue 为字段设置值。 I get this error Unhandled Rejection (TypeError): Cannot read property 'setFieldsValue' of null.我收到此错误 Unhandled Rejection (TypeError): Cannot read property 'setFieldsValue' of null。 How can I fix it?我该如何解决?

Add your code.添加您的代码。 As I had this issue, this is cause the form ain't initialized yet.由于我遇到了这个问题,这是因为表单尚未初始化。 If you provide your code, people can see, and tell you a solution.如果您提供代码,人们可以看到并告诉您解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM