Skip to content

FormList 配合 namePath,getFieldsValue 内容异常。 #27396

@juzhiyuan

Description

@juzhiyuan
  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://ant.design/components/form-cn/#name-%E4%B8%BA%E6%95%B0%E7%BB%84%E6%97%B6%E7%9A%84%E8%BD%AC%E6%8D%A2%E8%A7%84%E5%88%99%EF%BC%9F

Steps to reproduce

<Form.List name="nodes">
        {(fields, { add, remove }) => (
            {fields.map((field, index) => (
              <Form.Item
                required
                key={field.key}
              >
                    <Form.Item
                      name={[field.name, 'host']}
                    >
                      <Input placeholder="域名/IP" disabled={readonly} />
                    </Form.Item>
              </Form.Item>
            ))}
        )}
      </Form.List>

使用 form.getFieldsValue 时,从第二条数据开始,内容变为:

{
  "nodes": [
    {
      "host": "123"
    }, 
    {
      "host": "456",
      "altKey": null,
      "cancelable": null,
      "defaultPrevented": null,
      "dispatchConfig": null,
      "getModifierState": null,
      "等等 Event": null
    }
  ]
}

What is expected?

只有 host 字段

What is actually happening?

包含了类似 Event 的键

Environment Info
antd 4.7.3
React 16.8.6
System MacOS Catalina
Browser Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions