So I've created a simple wrapper component with template like:
<wrapper>
<b-table v-bind="$attrs" v-on="$listeners"></b-table>
</wrapper>
using $attrs
and $listeners
to pass down props and events.
Works fine, but how can the wrapper proxy the <b-table>
named slots to the child?
Vue 2.6 (v-slot syntax)
All ordinary slots will be added to scoped slots, so you only need to do this:
Vue 2.5
See Paul's answer.
Original answer
You need to specify the slots like this:
Render function
You probably also want to set
inheritAttrs
to false on the component.I have been automating the passing of any (and all) slots using
v-for
, as shown below. The nice thing with this method is that you don't need to know which slots have to be passed on, including the default slot. Any slots passed to the wrapper will be passed on.