Is there no way to reliably work with slot content in a render function in Vue 3? #7728
Unanswered
d-ryabtsev
asked this question in
Help/Questions
Replies: 1 comment
-
@yyx990803 On the off chance you might see this, it would help my upgrade work very much if I could get an answer :) |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
I know below may not be conventional or optimal solutions in Vue 2 but I am currently upgrading an enormous application to Vue 3 and struggling to comprehend how to change existing render functions without changing the architecture of components. In Vue 2 the following was possible:
Here we could dig into
defaultSlotContent
and even access component instances of any components that could have been inserted into it. I understand that accessing component instances is not longer possible. However below also seems to be impossible. Imagine a parent component trying to usemy-component
however it is providing its own slot for the slot content ofmy-component
And using the cool-component like so:
Now when I take a look at the content of
defaultSlotContent
inmy-component
- I am not seeing the divs. Before I was able to access the final rendered content of the slot hierarchy. Now I can only see 1 element which doesn't look like what I need.Can somebody provide clarity/confirmation on whether this example is fixable in Vue 3 or does this need a complete rewrite? For context what I am trying to achieve is to create a component which has 1 slot and when rendering content of that slot - it separates each element entered into the slot with an arbitrary component. It's a list component, we are separating each
div
with a separator.Beta Was this translation helpful? Give feedback.
All reactions