-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Labels
Description
What problem does this feature solve?
When doing a composition of component like this:
Child component with slot
<template>
<div>
child
<slot name="slot" ref="slot"/>
</div>
</template>
<script>
export default {
name:'child'
}
</script>
Parent component
<template>
<div>
parent
<child>
<custom-component slot="slot"/>
</child>
</div>
</template>
<script>
import Child from './child.vue';
import CustomComponent from 'custom-component';
export default {
name:'parent',
components:{ Child, CustomComponent }
}
</script>
it would be great to access custom-component (component not element ) using this.$refs.slot
.
Currently its done using this statement this.$slots.slot[0].componentInstance
, this.$refs.slot
is undefined
.
Use case is calling child slot component methods.
Thanks
What does the proposed API look like?
Accessing slot component using
this.$refs.slot
b-strauss, vincerubinetti, johnsmithjsjs, mitar, AngeloSchulerPiletti and 5 more