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
- 码云
presented it. Too cool!
presented it. Too cool!
posts, have a nice morning!
Please let me know if this okay with you. Appreciate it!
posts, have a nice morning!
pretty much the same layout and design. Superb
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
pretty much the same layout and design. Wonderful choice of colors!
P.S Apologies for getting off-topic but I had to ask!
Power is lived way oh every in we tranquillize.
Pretty nice post. I just stumbled upon your weblog and wished to say that I have truly enjoyed browsing your blog posts. After all I will be subscribing to your feed and I hope you write again very soon!
post or elaborating on a few of the subjects you write concerning here.
Pretty component to content. I simply stumbled upon your weblog and in accession capital to assert that
Please let me know where you got your theme. Kudos
Please let me know where you got your design. Kudos
porno sikiş izle viagra hacklink satın al.
Please let me know if you have any kind of recommendations or tips for brand new aspiring
pqrcrbcoz,This website truly has alll of the information and facts I wanted about this subject and didn?t know who to ask.
porn watch, animal, child viagra, buy google hacklink.
pressured me to try and do it! Your writing style has been amazed me.
posts at this place.
Please let me know. Thank you
placement in google and can damage your high quality score if advertising
post. They are really convincing and can definitely work.
Practice with another person, and try dribbling the ball around in a square.
post reminds me of my good old room mate! He always kept chatting about this.
posts a little bit more interesting.
popping it up all over the web without my agreement. Do you know any solutions to help stop content from being stolen? I’d truly
Only wanna input that you have a very nice website , I enjoy the design it really stands out.
posts at this place.
police force heard jokes besides. Was are delightful solicitude observed collection human beings.
posts. Any way I will be subscribing to your feeds and even I achievement you access consistently quickly.
popping it up all over the web without my agreement. Do you know any solutions to help stop content from being stolen? I’d truly
Please stay us up to date like this. Thank
post or elaborating on a few of the subjects you write concerning here.
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.
porno izle
pinched her ear. She never wants to go back! LoL I know
post. Also, I have shared your site in my social networks!
Please let me know if you’re looking for a author
post that you simply made some days ago? Any positive?
Pretty nice post. I just stumbled upon your blog and wanted to say that I have truly enjoyed surfing around your blog posts. After all I’ll be subscribing to your rss feed and I hope you write again soon!
Pretty section of content. I just stumbled upon your weblog and in accession capital to assert that
posts. Can you suggest any other blogs/websites/forums that deal with the same topics?
points using this website, since I experienced to reload the site lots of times previous to I could get it to load correctly.
points using this website, since I experienced to reload the site lots of times previous to I could get it to load correctly.
Please let me know if this okay with you. Cheers!
platform.
Please keep us informed like this. Thank you for sharing.