Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

form.list add(initvalue) fields.map(item) why item does not contain this add's initvalue #27763

Closed
1 task
qiansimin88 opened this issue Nov 13, 2020 · 6 comments

Comments

@qiansimin88
Copy link

  • 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

  1. 通过按钮添加add(1)
  2. fields.map(field => console.log(field))
  3. field 拿不到初始值,只有默认的{ fieldKey: 0
    isListField: true
    key: 0
    name: 0 }

What is expected?

  1. 既然 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

@afc163 afc163 added 📝 Documentation 🤔 Need Reproduce We cannot reproduce your problem labels Nov 18, 2020
@ant-design-bot
Copy link
Contributor

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 将会被自动关闭。

@zombieJ
Copy link
Member

zombieJ commented Nov 18, 2020

@afc163
Copy link
Member

afc163 commented Jun 22, 2021

@zombieJ 可以关了么

@JackDan9
Copy link

JackDan9 commented Dec 20, 2021

请增加到react-component中在文档当中也体现一下吧,不然没办法去做了。
我已经用Table去做动态增加表单项的操作的,但是还是希望社区统一的办法去修复这个问题。

@d0ublezer0
Copy link

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

@zombieJ zombieJ closed this as completed Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants