Home

Issue: 2206

Event listener doesn't remove when route to other page

[issue link]

I have scroll event listeners in one of the components that I am using on particular Page. The problem is this event listeners is triggered even after I navigate out of this page (where I am using this component). How to fix it? I got console full of errors.

created () {
    if (process.browser) {
      window.addEventListener('scroll', this.parallax)
    }
  },
  destroyed () {
    if (process.browser) {
      window.removeEventListener('scroll', this.parallax)
    }
  }
This question is available on Nuxt.js community (#c1945)