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;
}
},
 
 
posted @ 2019-03-08 09:43  gz_blog  阅读(2611)  评论(0编辑  收藏  举报