Reuse "virtual slots" #12818
Unanswered
kogratte
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.
-
Hey there!
I would like to write a component that may reuse some of its child's inner slot contents.
Let me elaborate.
I wrote this piece of code, let's say, root component.
Then, I also wrote a "child component", like below:
this way, I can use something like that:
This way, I can have a single entry point and add some stuff based on child components. This is very useful when creating some kind of scrollable automation. Anyway.
I want to be able to get a child slot content from the root one.
In order to do so, what I did is similar as this:
It works well if the target slot has been rendered, but not in case I'm using a "shadow slot", IE, a slot that does not need to be rendered on the final component, but may be specified for some reason, let's say:
In this very specific case, I need to run the slot function and extract content this way:
This post is because I cannot understand the underlying logic. Why should I deep dive recursively? Is there an elegant way to achieve such a result? If someone can enlighten me...
Beta Was this translation helpful? Give feedback.
All reactions