代碼如下:我使用了官方推薦的wrappedComponentRef方式,獲取到了子組件的實例,但是打印出來卻不是自己所期望的那樣有method方法請問下我是哪里寫錯了,還是這種官網(wǎng)并沒有掛載自定義方法上去???這是參考的例子:https://github.com/react-comp...這是官網(wǎng)的說明:https://github.com/react-comp...有以下片段代碼:class Form extends React.Component { ... }// deprecatedconst EnhancedForm = createForm({ withRef: true })(Form);<EnhancedForm ref="form" />this.refs.form.refs.wrappedComponent // => The instance of Form// Recommendedconst EnhancedForm = createForm()(Form);<EnhancedForm wrappedComponentRef={(inst) => this.formRef = inst} />this.formRef // => The instance of Form這個問題困擾了不少人啊,有哪位大俠出手相助?。?
antd form.create 后父組件如何獲取到子組件的自定義方法
臨摹微笑
2019-02-14 14:15:10