vue如何正确销毁当前组件的scroll事件?

1. 要销毁handleFun的话,得把handleFun写在method中

2. 应该是window.addEventListener("scroll",this.handleFun)和window.removeEventListener("scroll",this.handleFun)

而不 是window.addEventListener("scroll",this.handleFun())和window.removeEventListener("scroll",this.handleFun())

第二个参数应该是一个function,而不是执行它。

原文地址:https://www.cnblogs.com/benbentu/p/14251413.html