0👍
Assuming, you are using scrolled event listener on window
object using your mounted()
lifecycle method, you must de-register the global event listener on window
object:
const opts = {
mounted() {
window.addEventListener('scroll', this.scrolled);
},
beforeDestroy() {
// UN-REGISTER THE GLOBAL HANDLER BEFORE COMPONENT IS DESTROYED
window.removeEventListener('scroll', this.scrolled);
},
method: {
scrolled() {
/* Your Logic */
}
}
};
Source:stackexchange.com