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

Account for transition periode#550

Closed
arcs- wants to merge 2 commits intosurmon-china:masterfrom
arcs-:master
Closed

Account for transition periode#550
arcs- wants to merge 2 commits intosurmon-china:masterfrom
arcs-:master

Conversation

@arcs-
Copy link
Copy Markdown

@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
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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