react 報錯:TypeError: Cannot read property ‘getFieldDecorator’ of undefined 解決方法:在class前添加 @Form.create() 即可 例如: @Form.create() class myComponent ...
我們會直接 const getFieldDecorator this.props.form 直接使用getFieldDecorator 會報錯 Cannot read property getFieldDecorator of undefined 后來查找看了下原因為 使用getFieldDecorator需要導出form組件 export default Form.create 於是就ojbk了 ...
2020-09-08 15:40 0 1164 推薦指數:
react 報錯:TypeError: Cannot read property ‘getFieldDecorator’ of undefined 解決方法:在class前添加 @Form.create() 即可 例如: @Form.create() class myComponent ...
可能是因為formItem里放了caccade級聯 這個時候直接寫就好 不用在里面校驗 ...
之前使用antd的ui表單,卻沒發現這么好用的用法,推薦給大家 使用getFieldDecorator ,因為是antd的form的屬性,所以需要導出form組件,export default Form.create()(FormLogin); 效果: 可通過 ...
1)getFieldDecorator是一個方法,這個方法接收兩個參數,第一個是表單的字段對象,第二個是驗證規則。這個方法本身返回一個方法,需要將需要獲取值的標簽包裹進去。 const formItemLayout = { labelCol ...
單封裝 const { getFieldDecorator } = this.props.form; ...
將會自帶 this.props.form 屬性,通過解構賦值將 form 解構出來 ...
這里使用了props.form.getFieldDecorator(id,{選擇操作})方法來包裝一個Input輸入框組件,傳入的第一個參數表示這個字段的Id,第二個參數是一個配置對象,這里設置了表單控件的校驗規則rules。 問題:填寫Form表單時會發報 Warning ...
后台管理系統常用到表單的增刪改,這里也做了個封裝 例如:user/index.js ETable/index.js ETable/index.scss ...