vue监听滚动条滚动事件
created () {this.listenerFunction();},beforeDestroy () {document.removeEventListener("scroll", this.listenerFunction);},method () {listenerFunction(e) {document.addEventLis...
·
created () {
this.listenerFunction();
},
beforeDestroy () {
document.removeEventListener("scroll", this.listenerFunction);
},
method () {
listenerFunction(e) {
document.addEventListener('scroll', this.handleScroll, true);
},
handleScroll () {
console.log(window.pageYOffset)
}
}
更多推荐
已为社区贡献2条内容
所有评论(0)