-
Notifications
You must be signed in to change notification settings - Fork 295
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
feat: getFieldProps
返回值增加 name
#7
Comments
增加属性 nameProp 默认 false getFieldProps('xx',{nameProp:'name'}) =>{name: 'xx'} |
默认 另外为什么就不能默认就返回 |
污染组件 prop |
这样也不行是吧。。 |
不能默认返回组件可能不需要的信息 |
嗯,我再想一下有没有别的封装办法。。。 |
getFieldProps 等封装到 formItem <FormItem form={this.props.form} name="xx" rules={}>
</Form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rc-form 应该不会集成到 antd 里面了,毕竟是纯功能的,而且集成进去可能会导致
antd.Form
变复杂。但是觉得可以利用 rc-form 简化
FormItem
的用法,如果getFieldProps
的返回值增加name
字段,那么FormItem
的validateStatus
和help
都可以自行计算出来,就不需要用户传入了。当然,如果用户传入,就会优先使用用户设置的值。当然,如果连
required
都暴露出来的话,FormItem[required]
也可以自动设置,不过这个需要计算,而name
值则是直接使用getFieldProps
的第一个参数就行。@yiminghe
The text was updated successfully, but these errors were encountered: