先来一波报错
_this.props is undefined
You cannot set a form field before rendering a field associated with the value.
统一解决办法为:
异步0秒解决
setTimeout(() => {
this.form.setFieldsValue({
'screeningNo': '123'
})
}, 0)
本文介绍了一种在React中遇到的常见错误:“_this.propsisundefined”和“Youcannotsetaformfieldbeforerenderingafieldassociatedwiththevalue”。提供了一个简单而有效的解决方案,通过使用setTimeout异步设置表单字段值,避免了直接在渲染前设置值的问题。
先来一波报错
_this.props is undefined
You cannot set a form field before rendering a field associated with the value.
统一解决办法为:
异步0秒解决
setTimeout(() => {
this.form.setFieldsValue({
'screeningNo': '123'
})
}, 0)
870
6494

被折叠的 条评论
为什么被折叠?