vue js 判断鼠标滚动到底部 数据更新

1.监听鼠标滚动时间

mounted() {
window.addEventListener("scroll", this.handleScroll, true);
},
2.获取相关的高度 判断鼠标滚动到浏览器的底部
handleScroll() {
var scrollTop =
document.documentElement.scrollTop || document.body.scrollTop; //变量windowHeight是可视区的高度
var windowHeight =
document.documentElement.clientHeight || document.body.clientHeight; //变量scrollHeight是滚动条的总高度
var scrollHeight =
document.documentElement.scrollHeight || document.body.scrollHeight;
if (scrollTop + windowHeight == scrollHeight) {
//请求数据接口
// this.seeMoreSchoolList();
return false;
}
},
 
 

猜你喜欢

转载自www.cnblogs.com/zhengao/p/10493999.html
今日推荐