Skip to content

Instantly share code, notes, and snippets.

@onmotion
Last active May 27, 2019 11:48
Show Gist options
  • Save onmotion/0a2efce1fe07d7914d28b15b23c5d496 to your computer and use it in GitHub Desktop.
Save onmotion/0a2efce1fe07d7914d28b15b23c5d496 to your computer and use it in GitHub Desktop.
Vue js pass slot to child component wrapper through template
<!-- pass scoped slots -->
<!-- bind props as a Object for reactively binding props which contains getter and setter -->
<template v-for="(_, name) in $scopedSlots" v-slot:[name]="slotData">
<slot :name="name" v-bind="{props: slotData}" />
</template>
<!-- pass slots -->
<template v-for="(_, name) in $slots" :slot="name">
<slot :name="name"/>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment