我有几个页面需要滚动条滚动到底部加载,监听的事件名也是不一样,进入第一页的时候可以很好,可是点击到第二页的时候刚进去就会执行加载事件,这是怎么回事
window.addEventListener('scroll', this.scrollTable, true)
scrollTable: function () {
let visibleHeight = document.documentElement.clientHeight
let scrollHeight = document.documentElement.scrollHeight
let scrollTop = document.documentElement.scrollTop
console.log(scrollHeight, scrollHeight, scrollTop)
if (scrollHeight - (scrollTop + visibleHeight) === 0) {
this.pageScrollChange(1, 5)
}
}
楼主使用的应该是单文件模式。
是这样