I wrote a component (Component B) that accepts list of custom components via slot like this
// Component A
<div class="component-a">
...
<component-b>
<component-x></component-x>
<component-y></component-y>
</component-b>
...
</div>
and I want to wrap component x and y in other component, such as li tag.
// Output
...
<ul>
<li><component-x></component-x></li>
<li><component-y></component-y></li>
</ul>
...
I tried with
// Component B
<div class="component-b">
<ul>
<li v-for="item in $slots.default">
<component :is="item"></component>
</li>
</ul>
</div>
It doesn't work. The item is VNode object and it can't render with component tag. Is there any solution to solve this problem?
Edit: My wrapping component is not li tag, it's a custom component with specified props that I set it in component B. If I wrap them from component A, I need to write the custom component and its props repeatedly.
Edit2: Render function maybe solve this problem, but I'm looking for solution with html template (single file component).
<component :is="item.name"></component>
, just an idea. Because :is expects a compoent-name not an object reference. – Reiner