Initially, my window listener was working perfectly fine. However, at some point in time, it suddenly stopped functioning properly. The resize event also ceased to work. I am completely clueless as to why it is no longer operational.
mounted () {
window.addEventListener('scroll', this.test)
},
destroyed () {
window.removeEventListener('scroll', this.test)
},
methods: {
test () {
console.log('test')
}
}
UPDATE
I attempted to create a listener within the main Vue app component, but unfortunately, it still does not seem to be working.
<template>
<div id="application" class="" style="height: 200vh">
<!-- <router-view/>-->
</div>
</template>
<script>
export default {
name: 'App',
mounted() {
window.addEventListener('scroll', this.test);
},
methods: {
test () {
console.log('test')
}
},
watch: {
$route: {
immediate: true,
handler(to) {
document.title = this.$t(to.meta.title) || 'Some Default Title'
}
},
}
}
</script>
UPDATE 2 Upon mounting the component, the function seems to be triggered twice by the event listener, neither more nor less. screenshot