Skip to content

How apply all slot to children? #5962

Answered by tony19
yoyo837 asked this question in Help/Questions
May 19, 2022 · 3 comments · 2 replies
Discussion options

You must be logged in to vote

I think you're asking how to forward the current component's slots to the <van-loading> child component. That can be done like this:

<van-loading>
  <template v-for="(_, slot) of $slots" v-slot:[slot]="scope">
    <slot :name="slot" v-bind="scope" :key="slot" />
  </template>
</van-loading>

demo

Edited to insert :key binding on <slot>

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@yoyo837
Comment options

@tony19
Comment options

Answer selected by yoyo837
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants