scroll-view 为什么没有滚动结束时触发的钩子?

发布于 8 年前作者 xiulan688560 次浏览最后编辑 8 年前来自 ask

我想

做一个横向滚动的滑轮,判定黑色的框里该展示哪一个视图,然后使用类似swiper的动画滑动过去,现在的问题是,scroll-view 没有结束钩子,不知道该什么时候判断。

1 回复
luochao
luochao1 楼6 年前

自己想歪门办法啊

onScroll: function (ev) {
        if (this.scrollEndTimer) {
            clearTimeout(this.scrollEndTimer);
            this.scrollEndTimer = null;
        }
 
        this.scrollEndTimer = setTimeout(function () {
            console.log('滑动停止');
        }, 300);
 
    }