Can't access children array from parent slot.default() if the child is a custom component.
Vue version
3.3.8
Link to minimal reproduction
Steps to reproduce
I created 3 different component
- Parent: This contains a slot and this is where I want to get all children inside.
- Child: Basic child component with text
- ChildWithChildren: Compontent with some divs.
When I console.log
the elements from the slot.default()
it shows an array with 4 element which is good but when you start go down the tree you can see where we have custom component there the children
is null, but if it's regular html element like <div></div>
it contains children elements.
What is expected?
To be able to get children elements from custom component.
What is actually happening?
The children
is null
System Info
No response
Any additional comments?
No response
Well yes, components manage their own virtual dom, so the Vnodes that you get from the slot will not contain the Vnodes located in a child component.
That's how components work a virtual dom.