Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide API for parent component to control the destroying of Flickity #59

Closed
cbgesbocker opened this issue Feb 28, 2020 · 1 comment
Closed

Comments

@cbgesbocker
Copy link

cbgesbocker commented Feb 28, 2020

To prevent the slideshow from collapsing when the parent component is destroyed

Parent.vue

<flickity @flickity:beforeDestroy="handleFlickityDestroy" ref="flickity" ... />


<script>
export default {
    methods: {
        handleFlickityDestroy() {
             this.$refs.flickity.destroy()
        }
    }
}
</script>

Flickity.vue

  beforeDestroy() {
    // provide event API for parent component to control 
    // destroying this component on beforeDestroy
    this.$emit('flickity:beforeDestroy', this.$flickity);
    if (this.options.destroyAutomatically) {
      this.$flickity.destroy();
    }
    this.$flickity = null;
  },
@hakimmazouz
Copy link

Did you end up finding a way to delay the destruction of the component?

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

No branches or pull requests

2 participants