Ant-design-pro: 🧐[问题] 🧐 setFieldsValue赋值问题

Created on 31 Jul 2020  ·  8Comments  ·  Source: ant-design/ant-design-pro

🧐 setFieldsValue赋值问题

💻 示例代码

setFieldsValue({
ChildForm[index].subject: [{label: '项目名称', value: 1}]
})

当index是变量的时候应该怎么写

🕵🏻‍♀️ question

All 8 comments

这种基础问题 你也好意思 在这来问 。。。。

我试了好几种都不对才问的,不能问?

这种基础问题你也好意思在这来问。。。。

你是需要修改ChildForm中第index项的值吗?

你是需要修改ChildForm中第index项的值吗?

是的,ChildForm里有好几组数据,我直接写ChildForm[0].subject可以赋值,但是当那个0是一个变量的时候试过好几种方法都不对,ChildForm[${index} ].subject这种也尝试过

能贴一下setFieldsValue这块实际的代码吗?

逻辑是某个事件会修改当前项的subject值,之前的代码是赋值的地方,下面的是渲染页面的代码,主要就是想知道setFieldsValue怎么给当前项的subject赋值

{getFieldDecorator(ChildForm[${(parseInt(pane.key) - 1).toString()}].subject)(
,
)}

setFieldsValue({
      [`ChildForm[${index}].subject`]: value,
})

我一般是这样写的,按理来说应该没什么问题

setFieldsValue({
      [`ChildForm[${index}].subject`]: value,
})

我一般是这样写的,按理来说应该没什么问题

可以可以太感谢了

Was this page helpful?
0 / 5 - 0 ratings

Related issues

suifan picture suifan  ·  3Comments

renyi818 picture renyi818  ·  3Comments

lvzheng0404 picture lvzheng0404  ·  3Comments

Yoping picture Yoping  ·  3Comments

2uncle-code picture 2uncle-code  ·  3Comments