HTML
<div class="input-list" @scroll="scrollEvent($event)"></div>
// @scroll.passive="houseListScroll($event)"
Js
data(){
return{
timer:null,
}
}
scrollEvent(e) {
//这里注释的代码是网上很多同行写的,用是能用,但是有很大的问题
// if(e.srcElement.scrollTop+e.srcElement.offsetHeight>e.srcElement.scrollHeight-100){
//clearInterval(this.timer)
//this.timer = setTimeout(() => {
//console.log("啦啦啦啦啦触发了")
//}, 500)
// }
if (e.target.scrollTop + e.target.offsetHeight >= e.target.scrollHeight) {
//防抖节流
clearInterval(this.timer)
this.timer = setTimeout(() => {
console.log("啦啦啦啦啦触发了")
}, 500)
}
},
.input-list-box {
height: 75vh;
overflow: auto;
overflow-x: hidden;
}