Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Account for transition periode #550

Closed
wants to merge 2 commits into from
Closed

Conversation

arcs-
Copy link

@arcs- arcs- commented Sep 11, 2019

When using a SPA one may have a transition from one page to another. Vue will call the beforeDestroy listener before the transition is over. To compensate this change adds a delay of 1 second before the slider gets destroyed.

Other solutions are welcome but I couldn't find one in the few minutes I had. This change should not have a negative impact on any application as it only delays the removal.

@bariscc
Copy link

bariscc commented Sep 17, 2019

Having this problem as well. I think Vue should wait until the transition is complete to call beforeDestroy.

@bariscc
Copy link

bariscc commented Sep 18, 2019

@arcs- Destroying swiper in the parent components' beforeDestroy() seems to work:

computed: {
    swiper() {
      return this.$refs.mySwiper.swiper;
    }
  },
  beforeDestroy() {
    this.swiper.destroy(false, false);
  }

Might be useful if added to readme @surmon-china

@surmon-china
Copy link
Owner

Thanks!

v4.0.0 new feature:

<swiper :options="options" :auto-destroy="false">

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants