drewjbartlett / vue-flickity

A Vue Slider / Carousel Component for Flickity.js
http://drewjbartlett.com/demos/vue-flickity/
374 stars 55 forks source link

cannot access flickity via this.$refs #52

Open andersaamodt opened 5 years ago

andersaamodt commented 5 years ago

I added a ref="flickity" property to my component, but it is not accessible via this.$refs.flickity, even in the mounted() function. I tried suggestions from this thread and this thread but nothing worked. Does anyone know why this is happening?

paullacour commented 5 years ago

@andersaamodt I had the same issue, I wanted to access the selectedIndex in this.$refs.flickity and it was undefined even in mounted() cycle. So I followed @Yakoot advice in #45 and it worked... onInit(){ this.$refs.flickity.on('change', (index) => { console.log(index) }) }