0👍
✅
More on this:
I’m pretty sure it’s happening because you’re not properly removing the component from the DOM between different app states (though you think you do).
-
Check your
v-if
s, sometimes you can notice some redundancy on their conditions. -
Be sure you’re not allowing
Bus
instance to register the same even handler twice, thus callingBus.$off
on every destroy hook in the lifecycle.
Example:
export default {
components: {
StripeCheckout
},
methods: {
onStripeSuccess (payload) {
// do stuff with payload
}
},
created () {
Bus.$on('vue-stripe.success', this.onStripeSuccess)
},
beforeDestroy () {
Bus.$off('vue-stripe.success')
}
}
Component lifecycle: https://v2.vuejs.org/v2/guide/instance.html#Lifecycle-Diagram
Removing event listeners: https://v2.vuejs.org/v2/api/#vm-off
Source:stackexchange.com