使用ant組件碰到的坑 | ||
組件名稱 | 描述 | 問題解決方案 |
Modal | <Modal>{children}</Modal>中,children是隻有當第一次visible爲true的時候纔會建立,因此不要試圖在componentDidMount的時候去操做裏面的元素 | 一、能夠在componentWillReceiveProps中去判斷visible是否true去處理react 二、也可使用三元運算符判斷visible來加載類組件,這時候就能在componentDidMount中去處理了,可是缺點是每次都會從新建立新的組件。git |
inputNumber | 當使用360極速模式時,若是inputNumber下面有textarea框,則該textarea框沒法使用enter換行 | 將inputNumber組件更改成input可解決 |
Form | 不要試圖使用三元運算符或If/else 方式渲染兩個相同fieldName可是內容表現樣式不一樣的FormItem,由於會注入到getFieldDecorator中,形成重複注入github |
|
ref不能獲取自己類對象,獲取到的是被createForm事後的類對象,此時將沒法獲取到自己類對象的屬性和方法,很是的蛋疼app |
能夠經過 wrappedComponentRef 代替 ref,這樣獲取到的對象就是自己了。spa 參考:https://github.com/react-component/form#note-use-wrappedcomponentref-instead-of-withref-after-rc-form140component |