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
- 码云
person provide in your visitors? Is gonna be again incessantly to
Please let me know if you have any recommendations or tips
posts. Can you suggest any other blogs/websites/forums that deal with the same topics?
post reminds me of my good old room mate! He always kept chatting about this.
pretty much the same layout and design. Wonderful choice of colors!
page layout of your blog? Its very well written; I love what youve got to
Please let me know if you have any recommendations or tips
post that you simply made some days ago? Any positive?
pleasure forwarding absorbed correctitude. Exponent is lived agency oh every in we smooth.
porno sikiş izle viagra hacklink satın al.
Please keep us informed like this. Thank you for sharing.
page and at the moment this time I am browsing this site and reading very informative
please prolong them a little from subsequent time? Thank you for
Perhaps there is a way you are able to remove
please assist.
Please let me know where you got your theme. Kudos
please share. I know this is off subject but I just wanted to ask.
placed the shell to her ear and screamed. There was a hermit crab inside and it
posts at this place.
platform.
post. Also, I have shared your site in my social networks!
Perhaps you can write subsequent articles relating to this
over. I’m definitely enjoying the information. I’m book-marking and
please prolong them a little from subsequent time? Thank you for
post is simply nice and i can suppose you are a professional
Oh my goodness! Amazing article dude! Thanks, However I am having issues with your RSS. I don’t understand why I am unable to join it. Is there anyone else having the same RSS problems? Anyone who knows the solution will you kindly respond? Thanks!!
perbandingan tadalafil dan levitra buy cialis ricetta per tadalafil
Please let me know where you got your theme. Kudos
Perhaps you can write subsequent articles relating to this
Pjpjjk blikfv Buy branded viagra
pinched her ear. She never wants to go back! LoL I know
or two pictures. Maybe you could space it out better?
Please let me know. Thank you
plagorism or copyright infringement? My website has a lot of
Pfizer said it will provide pharmacists with specific training to support them in dispensing sildenafil to appropriate patients only , if the switch goes ahead.
Please let me know if you have any kind of recommendations or tips for brand new aspiring
post i thought i could also make comment due to this good paragraph.
other experienced people that share the same interest. If you have any
Ouasck ymyxpp Viagra medication Drug viagra
pinched her ear. She never wants to go back! LoL I know
Perhaps you could write subsequent articles regarding
on regular basis to take updated from most recent reports.
Perhaps there is a way you are able to remove
piece of writing to improve my knowledge.
placed the shell to her ear and screamed. There was a hermit crab inside and it
permission allow me to seize your feed to stay
particular info for a very long time. Thank you and best of luck.
once a entertainment account it. Look advanced to far added agreeable from you!
out the entire thing with no need side effect , folks can take a signal.
One thing is that when you find yourself searching for a student loan you may find that you’ll want a co-signer. There are many scenarios where this is true because you might discover that you do not use a past credit standing so the lender will require that you’ve got someone cosign the loan for you. Interesting post.