Hey, I have a Carousel component and a method like this:
carousel () {
return this.$refs.carousel
}
But when I try to pass it as a prop to another component, the data in the prop is coming back as undefined. Why is that happening?
<Dots :carousel="carousel()" />
Within the child component, here's what I have:
export default {
name: 'Dots',
props: ['carousel']
}
When I try calling console.log(this.carousel)
in the mounted hook, it returns undefined. However, I actually need to access the data of the Carousel component. How can I achieve this?
Here's a link to the sandbox for reference: https://codesandbox.io/s/flamboyant-monad-5bhjz?file=/src/components/Test.vue