What if the removeEventListener remove scrolling event does not work after the vue route is redirected?

After the

Bug:A page routes to page B, the removal of the "scroll bar drop down to the bottom to load more" event does not take effect, and the interface of page An is still being requested from the bottom of the B page scroll bar. The
code is as follows:


        methods: {
            //B
              goCommodityDetails(e){
                  window.removeEventListener("scroll", this.addEventScrollTop ,true)
                  this.$router.push({
                    path: "/commodityDetails",
                    query: {
                        t: Math.random(),
                        id: e.id
                    }
                });
              },
          },
          created () {
            window.addEventListener("scroll", this.addEventScrollTop ,true)
          },
          mounted () {

          },
          updated() {
 
          },
          destroyed(){
              window.removeEventListener("scroll", this.addEventScrollTop ,true)
          }
Jul.15,2021

//window.removeEventListener('scroll', this.addEventScrollTop ,true)
window.removeEventListener('scroll', this.addEventScrollTop ,false)

the same problem has just been solved


beforeRouteLeave
beforeRouteLeave(to,from,next){
    window.removeEventListener('scroll', this.addEventScrollTop ,true);
    this.$router.push({
       path: '/commodityDetails',
           query: {
            t: Math.random(),
             id: e.id
              }
         });
    next();// next()
}

didn't try remove? when beforedestroy is the hook.

Menu