gs-shop / vue-slick-carousel

🚥Vue Slick Carousel with True SSR Written for ⚡Faster Luxstay
https://gs-shop.github.io/vue-slick-carousel/
Other
803 stars 186 forks source link

Carousel broke on ajax call #228

Closed pushkarp-nimblechapps closed 2 years ago

pushkarp-nimblechapps commented 2 years ago

I am facing a wired issue that on initial load carousel working fine but after using pagination and load data using ajax. carousel not working.

How can i re-render carousel after content load?

Why this issue occur on ajax calling?

I have tried some solutions previously, but not success.

Please give some solution.

pushkarp-nimblechapps commented 2 years ago

Found the solution: use :key="carouseKey" in define it as data data() { return { carouselKey: 1 } }

use increase in function which trigger after Ajax call and render content. It will re-render the VueSlickCarousel component every time when key change.

function ajax() { this.carouselKey += 1; }