Most efficient way to obtain a reference to deeply-nested, dynamic children? #9846
Replies: 2 comments 1 reply
-
So, I tried taking the |
Beta Was this translation helpful? Give feedback.
-
I thought about a potential alternative of passing |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Say I have the following setup.
Then I do this:
I want to obtain a reference to all the
Panel
vnodes so that I can dynamically switch between them when the user clicks on their tab. Unexpectedly, Vue appears to merge the slots together into aFragment
, which complicates things. Walking the fragment recursively, and constantly calling$slots.default()
whenever I am presented with a default slot until I so happen to come across the vnodes that I want, doesn't seem like the best way to approach this. At the very least, it is not something I look forward to coding. There has to be a better way, perhaps even through Vue's own API, but I am unable to find any efficient alternatives.Beta Was this translation helpful? Give feedback.
All reactions