ant D源码中form组件只对是react-component form的一层封装
首先表单是双向绑定的

form在react中是怎么实现数据的双向绑定的?
在react中我们可以手动去绑定input框的值为一个state中的值,然后每次onchange时去更新state
刚看到createBaseForm.js的源码时,我猜测,reactForm也是这样实现的

默认的触发器就是onchange,再来看实现流程是怎么样的

createBaseForm返回一个高阶函数decorate

这里采用es5的类写法,getInitialState相当于Es6 Class中的constructor部分,在生成一个表单实例时就会有一个fieldsStore对象,通读全文后发现,很多复杂操都是在对这个全局store进行维护

getFieldDecorator是一个高阶函数,将传入的组件封装后返回
- 核心部分onChange的封装



在onCollect部分先通过onCollectCommon实现了原action也就是onChange的执行,再setFields更新当前表单的值

更新store后,强制刷新

这里已经能够大概知道form内部是怎么运作的了,我画了一张流程图

根据原理做了一个简单的demo
- npm
https://www.npmjs.com/package/zjx-react-form
- 码云
Please let me know where you got your design. Kudos
post i thought i could also make comment due to this good paragraph.
Pretty section of content. I just stumbled upon your site and in accession capital to assert that I acquire in fact enjoyed account your blog posts. Any way I’ll be subscribing to your feeds and even I achievement you access consistently rapidly.
Please stay us up to date like this. Thank
pretty much the same layout and design. Wonderful choice of colors!
pretty much the same layout and design. Wonderful choice of colors!
please share. I know this is off subject but I just wanted to ask.
presented it. Too cool!
Please keep us informed like this. Thank you for sharing.
Pretty nice post. I simply stumbled upon your blog and wished to mention that I have truly loved
Pretty! This has been an extremely wonderful article. Many thanks for providing this info.
post. Also, I have shared your site in my social networks!
Pretty nice post. I just stumbled upon your
positively useful and it has aided me out loads.
please prolong them a little from subsequent time? Thank you for
Peculiar article, exactly what I needed.
porn watch, animal, child viagra, buy google hacklink.
particular info for a very long time. Thank you and best of luck.
Pretty section of content. I just stumbled upon your site and in accession capital to assert that
Pretty component to content. I simply stumbled upon your weblog and in accession capital to assert that
Pretty nice post. I just stumbled upon your weblog and wished to say that I’ve really enjoyed browsing your blog posts. After all I will be subscribing to your rss feed and I hope you write again very soon!
post, we want develop more techniques on this regard, thanks for
Practice daily to ensure you get better.
pleasant in support of new visitors.
Pretty section of content. I just stumbled upon your blog and in accession capital to assert that I get actually enjoyed account your blog posts. Any way I’ll be subscribing to your augment and even I achievement you access consistently rapidly.
Perhaps you could write next articles referring to this article.
Pills will be cheaper.
Pretty great post. I simply stumbled upon your blog and wanted to mention that
pressured me to try and do it! Your writing style has been amazed me.
Pretty! This has been a really wonderful post. Thanks for supplying this information.
posts at this place.
posts. Can you suggest any other blogs/websites/forums that deal with the same topics?
Practice with another person, and try dribbling the ball around in a square.
Pretty section of content. I just stumbled upon your site and in accession capital to assert that
Pretty great post. I simply stumbled upon your blog and wanted to mention that
Pretty! This has been an extremely wonderful post. Thank you for providing this info.
prednisone 20 mg[/url] whenever move ever buddy
Pretty! This has been a really wonderful post. Thanks for providing this info.
present here at this blog, thanks admin of this
Please let me know if you’re looking for a article author
Pretty sure he will have a good read. Many thanks for sharing!
Pretty! This has been a really wonderful article. Thanks for supplying these details.
please assist.
Please let me know if you’re looking for a author
posts. Can you suggest any other blogs/websites/forums that deal with the same topics?
pretty much the same layout and design. Wonderful choice of colors!
Please let me recognize so that I could subscribe.
Pretty section of content. I just stumbled upon your site and in accession capital to assert that
posts. Any way I will be subscribing to your feeds and even I achievement you access consistently quickly.
Please stay us informed like this. Thanks for sharing.