
Lastor
coding 以前自己做 form 表單,狀態自然是自行管理。最近用過 antd 的 Form,他有內置組件的 local state 並跟你餵入的初始值隔離

Lastor
最初很不習慣,但深入寫寫發現這樣做還蠻方便的,不用自己去 handle form state

Lastor
且他的驗證、檢查,以及 get、set 資料全都有曝露出相關 API

Lastor
我們的初始 data 也不用做什麼處理,天然就形成隔離備份的 original data

Lastor
需要做 reset 回初始值之類的操作,就很容易

Lastor
用習慣之後,再回去用 element-ui 的 form 就覺得好難用


Lastor
element-ui 的 form 目前用起來比較像是純粹幫你套一層包裝,讓你可以做 value 驗證

Lastor
除此之外就只是一些 label 套版樣式而已,沒啥功能

Lastor
state 得自己 hold

Lastor
這樣的話跟我套不套 Form 組件,跟我自己手刻,區別還真不大
