Swiper collapses on route change #317
Comments
Interesting |
I have a similar issue with |
Is this the same issue as above? How to resolve this? @bgondy could you elaborate what you did to resolve this issue? or is it something which needs to be fixed within the swiper codebase? |
I am having the same issue. I have links inside the swiper, so it will start routing when I click on a swiper-item. Then before my page transition, the swiper resets and goes back to the start. I am using nuxtjs. |
@nataliawojtkowska @hoektoe @bgondy Check also http://idangero.us/swiper/api/ |
If you want to keep your slide on the same position as when you leave the page, you can check out: You could use mySwiper.progress to save the progress in your store before you leave the page and then when you come back on the page where your swiper is you can use mySwiper.updateProgress() to update the position in the mounted() function |
I have the same issue and tried to fix it with the destory/init solution mentioned before. |
I created a pull request to fix this issue. Let me know if it works for you ! |
Having the same issue on nuxtjs... Any updates on this? |
@guins I've implemented your fix and it works for me, the pull request has failed checks because the CI job failed. |
I had the same problem using page transitions on nuxt. |
|
I had the same problem when using SPA. i used this: vue-awesome-swiper i tried add an event like this: option: { |
Having the same issue as this, using Nuxt. |
@leopoldkristjansson I have the same issue and the PR has not been merged so in the meantime, you can use my colleague' s dirty solution by adding to the Swiper option to overwrite the destroy function:
|
I find keep alive works good for keeping presentation between changes routes. If you populate slides when the component is created. However if you populate when the component is activated. So updated everytime you go back to that route.. issues happen like first slide is visible but the rest of the slides are not but are still in the dom. |
The temporary fix from nonlinearcom seems to work for me too, however, instead of commenting out the part I just delayed it, so the swiper gets destroyed but only after the transition in
|
Solution for me
|
mounted() {
}, In my case i use bind - because context was lost |
This seems to work for me as it overrides the default destroy function:
|
Using the solution from @sebastianjung works for me:
|
Silence v4.x, you can control the destory params by props. <swiper
:options="swiperOptionsObject"
:auto-update="true"
:auto-destroy="true"
:delete-instance-on-destroy="true"
:cleanup-styles-on-destroy="true"
@ready="handleSwiperReadied"
@click-slide="handleClickSlide"
/> Upgrade to v4.x please! |
Using swiper version 3.1.3 with vue & nuxt
When rendering a new route, you can see the swiper collapse, I guess because it's being destroyed on
beforeDestroy
?Here's a video showing the issue
https://streamable.com/mthnx
The text was updated successfully, but these errors were encountered: