使用 @scroll 事件
div一定要有固定得高度,否则不触发
<template>
<div class="warp srcoll-content" @scroll="scrollBottom">
.....
</div>
</template>
// 样式写法一
.srcoll-content {
height: 100vh;
overflow: auto; // 必不可少
}
// 样式写法二
.srcoll-content {
position: fixed;
top: 0;
left: 0;
right:0;
bottom: 0;
overflow: auto;
}
// js
// 监测滚轮滑倒底部了
scrollBottom() {
let scrollTop = document.documentElement.scrollTop
let clientHeight = document.documentElement.clientHeight
let scrollHeight = document.documentElement.scrollHeight
console.log("1----scrollTop",scrollTop);
console.log("2----clientHeight",clientHeight);
console.log("3----scrollHeight",scrollHeight);
}
![](https://img-blog.csdnimg.cn/img_convert/92acf66fae3b490898dca1a931a74271.png)