{"action":"created","issue":{"url":"https://api.github.com/repos/react-component/form/issues/7","labels_url":"https://api.github.com/repos/react-component/form/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/react-component/form/issues/7/comments","events_url":"https://api.github.com/repos/react-component/form/issues/7/events","html_url":"https://github.com/react-component/form/issues/7","id":126350409,"number":7,"title":"feat: `getFieldProps` 返回值增加 `name`","user":{"login":"benjycui","id":3580607,"avatar_url":"https://avatars.githubusercontent.com/u/3580607?v=3","gravatar_id":"","url":"https://api.github.com/users/benjycui","html_url":"https://github.com/benjycui","followers_url":"https://api.github.com/users/benjycui/followers","following_url":"https://api.github.com/users/benjycui/following{/other_user}","gists_url":"https://api.github.com/users/benjycui/gists{/gist_id}","starred_url":"https://api.github.com/users/benjycui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjycui/subscriptions","organizations_url":"https://api.github.com/users/benjycui/orgs","repos_url":"https://api.github.com/users/benjycui/repos","events_url":"https://api.github.com/users/benjycui/events{/privacy}","received_events_url":"https://api.github.com/users/benjycui/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"benjycui","id":3580607,"avatar_url":"https://avatars.githubusercontent.com/u/3580607?v=3","gravatar_id":"","url":"https://api.github.com/users/benjycui","html_url":"https://github.com/benjycui","followers_url":"https://api.github.com/users/benjycui/followers","following_url":"https://api.github.com/users/benjycui/following{/other_user}","gists_url":"https://api.github.com/users/benjycui/gists{/gist_id}","starred_url":"https://api.github.com/users/benjycui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjycui/subscriptions","organizations_url":"https://api.github.com/users/benjycui/orgs","repos_url":"https://api.github.com/users/benjycui/repos","events_url":"https://api.github.com/users/benjycui/events{/privacy}","received_events_url":"https://api.github.com/users/benjycui/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2016-01-13T06:24:22Z","updated_at":"2016-01-14T02:46:36Z","closed_at":"2016-01-14T02:46:36Z","body":"rc-form 应该不会集成到 antd 里面了，毕竟是纯功能的，而且集成进去可能会导致 `antd.Form` 变复杂。\r\n\r\n但是觉得可以利用 rc-form 简化 `FormItem` 的用法，如果 `getFieldProps` 的返回值增加 `name` 字段，那么 `FormItem` 的 `validateStatus` 和 `help` 都可以自行计算出来，就不需要用户传入了。当然，如果用户传入，就会优先使用用户设置的值。\r\n\r\n```xml\r\n        <FormItem\r\n          label=\"用户名：\"\r\n          id=\"name\"\r\n          labelCol={{span: 7}}\r\n          wrapperCol={{span: 12}}\r\n          validateStatus={this.getValidateStatus('name')}  // 可自动生成\r\n          hasFeedback\r\n          help={(getFieldError('name') || []).join(', ')}  // 可自动生成\r\n          required>\r\n          <Input {...getFieldProps('name', {\r\n            rules: [\r\n              {require: true, min: 5, message: '用户名至少为 5 个字符'},\r\n              {validator: this.userExists},\r\n            ],\r\n          })} id=\"name\" placeholder=\"实时校验，输入 JasonWood 看看\" />\r\n        </FormItem>\r\n```\r\n\r\n当然，如果连 `required` 都暴露出来的话，`FormItem[required]` 也可以自动设置，不过这个需要计算，而 `name` 值则是直接使用 `getFieldProps` 的第一个参数就行。\r\n\r\n@yiminghe "},"comment":{"url":"https://api.github.com/repos/react-component/form/issues/comments/171513868","html_url":"https://github.com/react-component/form/issues/7#issuecomment-171513868","issue_url":"https://api.github.com/repos/react-component/form/issues/7","id":171513868,"user":{"login":"benjycui","id":3580607,"avatar_url":"https://avatars.githubusercontent.com/u/3580607?v=3","gravatar_id":"","url":"https://api.github.com/users/benjycui","html_url":"https://github.com/benjycui","followers_url":"https://api.github.com/users/benjycui/followers","following_url":"https://api.github.com/users/benjycui/following{/other_user}","gists_url":"https://api.github.com/users/benjycui/gists{/gist_id}","starred_url":"https://api.github.com/users/benjycui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjycui/subscriptions","organizations_url":"https://api.github.com/users/benjycui/orgs","repos_url":"https://api.github.com/users/benjycui/repos","events_url":"https://api.github.com/users/benjycui/events{/privacy}","received_events_url":"https://api.github.com/users/benjycui/received_events","type":"User","site_admin":false},"created_at":"2016-01-14T02:46:36Z","updated_at":"2016-01-14T02:46:36Z","body":"嗯，我再想一下有没有别的封装办法。。。"}}