判断div是否滚动到底部
//添加监听事件
document.getElementById('app').addEventListener('scroll', this.pageScroll);
//下拉到底事件
pageScroll(obj){
const { scrollTop, clientHeight, scrollHeight } = obj.target;
const threshold = 100; // 距离底部 100px 时触发
if (scrollTop + clientHeight >= scrollHeight - threshold) {
setTimeout(() => {
this.getItem();//下拉到底执行事件
}, 200);
}
},