UPDATE
This answer was written for the older pre v2.6 syntax. Since then, this syntax has been marked for deprecation. The core functionality stays the same, the functions(methods) work the same way as the properties that are being bound upwards (from child to parent), however the definition uses v-slot:default
now.
as per updated documentation (https://vuejs.org/v2/guide/components-slots.html#Scoped-Slots),
<span>
<slot v-bind:user="user">
{{ user.lastName }}
</slot>
</span>
Attributes bound to a element are called slot props. Now, in the parent scope, we can use v-slot with a value to define a name for the slot props we’ve been provided:
<current-user>
<template v-slot:default="slotProps">
{{ slotProps.user.firstName }}
</template>
</current-user>
Here is a more complicated example, as you will notice, the function and the scoped slots are passed using slotProps
Original answer with pre v2.6 syntax. Example of how to pass the slot-scope
parent:
<template>
<div slot="item" slot-scope="{ myLink, myMethod }">
<button @click="myMethod(myLink.title)">
Bookmark
</button>
</div>
</template>
child:
<template>
<li v-for="myLink in links">
<slot name="myLink" :myLink="myLink" :myMethod="myMethod"></slot>
</li>
</template>
<script>
export default {
methods: {
myMethod(link) {
link.bookmarked = true
}
}
}
</script>