dvajs / dva

🌱 React and redux based, lightweight and elm-style framework. (Inspired by elm and choo)
https://dvajs.com/
MIT License
16.25k stars 3.16k forks source link

被connect包裹的子组件,父组件怎么通过ref拿到组件里的函数 #2385

Closed cater111 closed 3 years ago

cater111 commented 4 years ago

connect的第四个参数{forwardRef : true}和{withRef : true}都用了,不好使。拿到的依然是被connect包裹的组件

luxiaowu commented 3 years ago

connect的第四个参数{forwardRef : true}和{withRef : true}都用了,不好使。拿到的依然是被connect包裹的组件

connect 的第四个参数使用 {withRef: true}后,获取到的 ref 对象包含一个 wrappedInstance 属性,就是被 connect 包裹的组件了 https://stackblitz.com/edit/dva-example-count-5yvkmz

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.