代码
//vue生命周期
created() { //监听滚动内
window.addEventListener("scroll", this.Scrollbottom, true);
},
destroyed() { // 离开页面销毁监听 否则其他页面还会触发并且可能出现其他问题
window.removeEventListener("scroll", this.Scrollbottom, true);
},
//methods里面声明方法
Scrollbottom() {
if (window.pageYOffset + window.innerHeight >= document.documentElement.scrollHeight ) {
console.log("滚动到底部了");
}
},