使用ant-design-vue的form时, 编辑时,从接口获取数据反写使用方法
this.form.setFieldsValue({
subjectId: [data.data.id, data.data.childrenList[0].id],
tblValue: this.detailObj.tableValue
})
报错警告 warning.js?d96e:34 Warning: You cannot set a form field before rendering a field 导致赋值没有效果 修改为下面的写法
this.form.getFieldDecorator('subjectId', { initialValue: [data.data.id, data.data.childrenList[0].id] })
this.form.getFieldDecorator('tblValue', { initialValue: this.detailObj.tableValue })
参考
官方网站: ant-design-vue