Reputation: 8090
I'm trying to access the scoped slots data passed from the child in the slot parent. There are numerous examples on how to do that in the template code (https://vuejs.org/guide/components/slots.html#scoped-slots), but how would one access the data in the actual component code (<script>
)?
<!-- <MyComponent> template -->
<div>
<slot :text="greetingMessage" :count="1"></slot>
</div>
<template>
<MyComponent v-slot="slotProps">
{{ slotProps.text }} {{ slotProps.count }}
</MyComponent>
</template>
<script>
export default {
// how can `slotProps` be accessed here?
}
</script>
Upvotes: 0
Views: 40