Answer the question
In order to leave comments, you need to log in
How to inherit slots in Vue?
How to inherit slots in Vue?
We use Vuetify components.
We want to add the ability to save column widths in v-data-table
.
To achieve this goal, we want to make a wrapper component for v-data-table
But how can we inherit all slots and props without verbose?
In order to use it in the future as a normal v-data-table
.
I assume that the entire family will need to be wrapped and styled as a component.
v-data-table
v-data-table-header
v-data-footer
v-edit-dialog
v-simple-checkbox
Answer the question
In order to leave comments, you need to log in
<template>
<v-data-table>
<template v-for="(_, slot) of $slots" :slot="slot">
<slot :name="slot"/>
</template>
<template v-for="(_, slot) of $scopedSlots" #[slot]="scope">
<slot :name="slot" v-bind="scope"/>
</template>
</v-data-table>
</template>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question