Skip to content

Commit

Permalink
🪲 Directly map slots for slot passthrough.
Browse files Browse the repository at this point in the history
Why? Typescript just doesn't seem able to handle the dynamic nature of Vue 3 slots.
  • Loading branch information
klondikemarlen committed Feb 26, 2024
1 parent 95a06bc commit f360a99
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions web/src/components/LockedTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@
disabled
append-icon="mdi-lock"
>
<!-- The typescript error here doesn't seem to cause any problems, so you can ignore it -->
<template
v-for="(_, slotName, index) of $slots"
:key="`${slotName}-${index}`"
#[slotName]="slotProps"
><slot
:name="slotName"
v-bind="slotProps || {}"
></slot
></template>
<template #append><slot name="append"></slot></template>
<template #default><slot name="default"></slot></template>
<template #loader><slot name="loader"></slot></template>
<template #prepend><slot name="prepend"></slot></template>
</v-tab>
</span>
</template>
Expand Down

0 comments on commit f360a99

Please sign in to comment.