{"action":"created","issue":{"url":"https://api.github.com/repos/ant-design/ant-design/issues/2965","repository_url":"https://api.github.com/repos/ant-design/ant-design","labels_url":"https://api.github.com/repos/ant-design/ant-design/issues/2965/labels{/name}","comments_url":"https://api.github.com/repos/ant-design/ant-design/issues/2965/comments","events_url":"https://api.github.com/repos/ant-design/ant-design/issues/2965/events","html_url":"https://github.com/ant-design/ant-design/issues/2965","id":175476813,"number":2965,"title":"[Issues]getFieldProps的第一个参数id能否自动匹配数组每一项并且正确返回？","user":{"login":"V-Tom","id":8033489,"avatar_url":"https://avatars.githubusercontent.com/u/8033489?v=3","gravatar_id":"","url":"https://api.github.com/users/V-Tom","html_url":"https://github.com/V-Tom","followers_url":"https://api.github.com/users/V-Tom/followers","following_url":"https://api.github.com/users/V-Tom/following{/other_user}","gists_url":"https://api.github.com/users/V-Tom/gists{/gist_id}","starred_url":"https://api.github.com/users/V-Tom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/V-Tom/subscriptions","organizations_url":"https://api.github.com/users/V-Tom/orgs","repos_url":"https://api.github.com/users/V-Tom/repos","events_url":"https://api.github.com/users/V-Tom/events{/privacy}","received_events_url":"https://api.github.com/users/V-Tom/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-07T11:16:45Z","updated_at":"2016-09-08T01:54:36Z","closed_at":null,"body":"<!-- Issue Template For Chinese Users -->\r\n\r\n<!-- 请按照下列格式报告问题，务必提供复现步骤，否则恕难解决，感谢您的支持。-->\r\n\r\n#### 本地环境\r\n\r\n<!-- 务必提供 -->\r\n\r\n- antd 版本:latest\r\n- 操作系统及其版本：Mac\r\n- 浏览器及其版本:chrome latest\r\n\r\n#### 你做了什么？\r\n我有一个数组需要去遍历，然后每一项都需要进行input form 验证。\r\n```javascript\r\n{\r\n  qoptions.map((item,index)=>{\r\n    return (\r\n       <Input {...getFieldProps(`qoptions[${index}].url`, {}}/>\r\n    )\r\n  })\r\n}\r\n```\r\n如果我按照上述方式来写,`this.props.form.validateFields`会自动返回下面结构:\r\n```javascript\r\n{\r\n  qoptions[0]:{\r\n    url:'xxx',\r\n    //或者其他fields\r\n  }\r\n}\r\n```\r\n所以，我需要在提交数据的时候再次遍历一次得到正确的数据\r\n<!-- 引入 antd 了 Button -->\r\n\r\n#### 你期待的结果是：\r\n有一种简洁的方法，可以有这样的返回结果\r\n```javascript\r\n{\r\n  qoptions:[\r\n    {\r\n      url:'xxx',\r\n       //或者其他fields\r\n    }\r\n  ]\r\n}\r\n```\r\n<!-- 像官网一样正常显示 -->\r\n\r\n#### 实际上的结果：\r\nRT\r\n<!-- 缺少样式 -->\r\n\r\n#### 可重现的在线演示\r\n无\r\n\r\n<!-- 请修改并 Fork http://codepen.io/anon/pen/wGOWGW?editors=001 -->\r\n"},"comment":{"url":"https://api.github.com/repos/ant-design/ant-design/issues/comments/245472167","html_url":"https://github.com/ant-design/ant-design/issues/2965#issuecomment-245472167","issue_url":"https://api.github.com/repos/ant-design/ant-design/issues/2965","id":245472167,"user":{"login":"V-Tom","id":8033489,"avatar_url":"https://avatars.githubusercontent.com/u/8033489?v=3","gravatar_id":"","url":"https://api.github.com/users/V-Tom","html_url":"https://github.com/V-Tom","followers_url":"https://api.github.com/users/V-Tom/followers","following_url":"https://api.github.com/users/V-Tom/following{/other_user}","gists_url":"https://api.github.com/users/V-Tom/gists{/gist_id}","starred_url":"https://api.github.com/users/V-Tom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/V-Tom/subscriptions","organizations_url":"https://api.github.com/users/V-Tom/orgs","repos_url":"https://api.github.com/users/V-Tom/repos","events_url":"https://api.github.com/users/V-Tom/events{/privacy}","received_events_url":"https://api.github.com/users/V-Tom/received_events","type":"User","site_admin":false},"created_at":"2016-09-08T01:54:36Z","updated_at":"2016-09-08T01:54:36Z","body":"@benjycui 这样写的话，返回数据结构为\r\n```javascript\r\n{\r\n  qoptions:{\r\n    0.url:'xxx',\r\n    1.url:'xxx'\r\n    //或者其他fields\r\n  }\r\n}\r\n```\r\n之前我写自己的组件的时候也遇到过这个问题，我是用的`.`来区分对象，但是数组没有很好的解决。\r\n\r\n`input`遍历是经常用到的，这个有好的解决方法吗？或者未来会支持？"}}
{"actor":{"display_login":"V-Tom"}}