Answer the question
In order to leave comments, you need to log in
Is it possible to reuse slots in vue components?
There is a component responsible for the header, I pass the menu to it via <slot name="menu"></slot>
.
I need this slot in two places, in the main header of the site, and in the fixed-header (it appears when the user scrolls down the site).
Vue.js throws an error during bottom manipulation, but does not crash, the site works fine!
Duplicate presence of slot "menu" found in the same render tree - this will likely cause render errors.
Answer the question
In order to leave comments, you need to log in
You can use render functions .
{
components: {
Render: {
functional: true,
render: (h, ctx) => ctx.props.vnode
}
}
}
<div class="header">
<render :vnode="$slots.menu"></render>
</div>
<div class="fixed-header">
<render :vnode="$slots.menu"></render>
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question