antonreshetov / vue-glide

A slider and carousel as vue component on top of the Glide.js
https://antonreshetov.github.io/vue-glide/
MIT License
269 stars 39 forks source link

events & callback #50

Open M-Barari opened 4 years ago

M-Barari commented 4 years ago

Hi, i'm new on all of these so i need help. first of all how this events work to begin with. you just listed them without use examples. And second and more important, i wanna send an axios request at the end of my carousel and load more items. i couldn't work with events so used active slide and watched it and on last slide sent and updated my data but slide still shows the previous one. what should i do?

iniakunhuda commented 4 years ago

Hi, I hope this can help you

<vue-glide @glide:build-after="functionName" @glide:run-after="functionName"></vue-glide>

M-Barari commented 4 years ago

@iniakunhuda thank you! yeah it helped a lot! which got me to my main problem! at end of carousel i call an axios and append to the data that glide is showing. but it wont show the new ones! i kinda know that it has something to do with vue-glide being client side rendered. What should i do? i hope i dont have to destroy it, but if i have to, how!!?

aubriehill commented 4 years ago

hey @m-barari! I just ran into a similar issue, you can force the vue component to refresh. I followed this https://michaelnthiessen.com/force-re-render/ and added a key to vue-glide component that I change when glide needs to update and make sure it has the correct amount of slides. Hope that helps!

M-Barari commented 4 years ago

@aubriehill , tanx. yeah , I came up with the same solution (to reload component with key change) , but unfortunately i have image on my glide and on reload it loads images again and it looks like the whole carousel is loading not appending (as it is). but if there is no image every thing is nice and smooth