[Vuejs]-Swiper.js bugged: It knows that there are multiples slides but it doesn't let you navigate through them

0👍

I found the answer to my question. I had to create a function to force the rerendering of the swiper component. Here’s the code:

forceRerenderSwiper() {
        // Remove my-component from the DOM
        this.renderComponent = false;

        // If you like promises better you can
        // also use nextTick this way
        this.$nextTick().then(() => {
            // Add the component back in
            this.renderComponent = true;
        });
    }

then you just add an if statement when you call the component

and don’t forget to set the renderComponent to true when you’re ready to render it.

Leave a comment