[Vuejs]-How to use v-for variable from slot in the parent component?

0👍

This is exactly what scoped slots are for.

For example, in your Slides template

<slot :slide="slide"></slot>

and in the parent…

<Slides v-model="slides">
  <AnotherComponent slot-scope="{ slide }" v-model="slide.someproperty"/>

Note: If using Vue < 2.5, you can only use slot-scope on a <template> element.

👤Phil

Leave a comment