- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
https://ant.design/components/form-cn/#components-form-demo-dynamic-form-items
Steps to reproduce
- 通过按钮添加add(1)
- fields.map(field => console.log(field))
- field 拿不到初始值,只有默认的{ fieldKey: 0
isListField: true
key: 0
name: 0 }
What is expected?
- 既然 form.list add(init, index) 第一个参数接受一个初始值,那么我肯定需要在代码里 判断这个初始值的,可我在fields.map(item) 这里的Item拿不到我的初始值,只有默认的{ fieldKey: 0
isListField: true
key: 0
name: 0 }
What is actually happening?
我想拿到我自己设置的初始值
Environment | Info |
---|---|
antd | 4.8.0 |
React | 16.12 |
System | mac |
Browser | chrome |
RT
6条答案
按热度按时间bmvo0sr51#
@zombieJ Form.List 动态新增项如何设置初始值,也是个日经帖了。
ecfdbz9o2#
Hello @qiansimin88. Please provide a online reproduction by forking this link https://u.ant.design/codesandbox-repro or a minimal GitHub repository. Issues labeled by
Need Reproduce
will be closed if no activities in 7 days.你好 @qiansimin88, 我们需要你提供一个在线的重现示例以便于我们帮你排查问题。你可以通过点击 此处 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。7 天内未跟进的 issue 将会被自动关闭。
7lrncoxx3#
加
p1iqtdky4#
@zombieJ 可以关了么
fjaof16o5#
请增加到react-component中在文档当中也体现一下吧,不然没办法去做了。
我已经用Table去做动态增加表单项的操作的,但是还是希望社区统一的办法去修复这个问题。
xxe27gdn6#
hello.
i have similar problem:
when add form list field onValuesChange received undefined value for each newly added field
https://stackblitz.com/edit/react-nj4v5o