关于You cannot set a form field before rendering a field associated with the value

5,648 阅读1分钟

延迟0毫秒,问题解决:

setTimeout(()=>{
this.props.form.setFieldsValue({
'userName':value.name
})
},0)

或者更合适的方法:

this.$nextTick(() => {
this.form.setFieldsValue(
this.$pick(object, [
'xxx'
])
)
})