methods:{
Scrollbottom () {
let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
let clientHeight = document.documentElement.clientHeight;
let scrollHeight = document.documentElement.scrollHeight;
if (scrollTop + clientHeight >= scrollHeight) {
console.log("滚动到底部了")
}
},
},
created(){
window.addEventListener('scroll', this.Scrollbottom);
},
destroyed() {
window.removeEventListener('scroll', this.Scrollbottom)//页面离开后销毁监听事件
},
遇到问题可以看我主页加我Q,很少看博客,对你有帮助别忘记点赞收藏