uni-app监听页面滚动

data() {
        return {
            // 开始与结束标识
            flag: false,
                        this.timer:'',
                        isShowLog:0
        }
    },
// 滚动监听事件
    onPageScroll(object)
    {
        console.log('开始滚动')
        this.isShowLog = 2
        // 只要滚动就清除状态
        clearTimeout(this.timer)
        
        // 告知标识 -> 开始滚动
        this.flag = false
        
        // 检测是否停留了 N 秒
        // 如果停留则表示滚动结束
        // N: 500(定时器时间 毫秒) -> 0.5秒算停止滚动
        // 滚动后多长时间算停止滚动
        this.timer = setTimeout(() => {
            console.log('结束滚动')
            this.isShowLog = 0
            // 告知标识 -> 结束滚动
            this.flag = true; 
        }, 500);
    },   
原文地址:https://www.cnblogs.com/peipeiyu/p/14595398.html