代碼如下:我使用了官方推薦的wrappedComponentRef方式,獲取到了子組件的實(shí)例,但是打印出來(lái)卻不是自己所期望的那樣有method方法請(qǐng)問(wèn)下我是哪里寫錯(cuò)了,還是這種官網(wǎng)并沒(méi)有掛載自定義方法上去???這是參考的例子:https://github.com/react-comp...這是官網(wǎng)的說(shuō)明: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這個(gè)問(wèn)題困擾了不少人啊,有哪位大俠出手相助??!
antd form.create 后父組件如何獲取到子組件的自定義方法
臨摹微笑
2019-02-14 14:15:10