created () {
this.listenerFunction();
},
beforeDestroy () {
document.removeEventListener("scroll", this.listenerFunction);
},
method () {
listenerFunction(e) {
document.addEventListener('scroll', this.handleScroll, true);
},
handleScroll () {
console.log(window.pageYOffset)
}
}
vue监听滚动条滚动事件
最后发布:2019-08-08 14:40:07首次发布:2019-08-08 14:40:07