在返回jsx的函数中,如何使其ref可以暴露到指定的组件实例? #11030
Unanswered
wszdca
asked this question in
Help/Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
例如在form-util.tsx中有这么一个方法
testFuc() { return <C ref='c_ref'/> }
然后我们在B组件中有这么render方法
class B { render() { return <> {testFunc()} <> } }
最后在A组件中展示B组件
class A { render() { <B/> } }
如何可以在A实例的refs中拿到C的ref呢?就是A中可以访问到 this.$refs.c_ref
Beta Was this translation helpful? Give feedback.
All reactions