import BScroll from “better-scroll”;
this.scroll = new BScroll(this.$refs.my_property, {
probeType: 3,
click: true,
bounce: false
});
this.scroll.on(‘scroll’, (pos) => {
let y = pos.y;
// console.log(y);
if (y >= 0) {
}
});
this.scroll.on(‘scrollEnd’, (pos) => {})
当 ProbeType 为 1 的时候,会非实时(屏幕滑动超过一定时间后)派发 scroll事件;
当 ProbeType 为 2 的时候,会在屏幕滑动的过程中实时的派发scroll事件;
当 probeType 为 3 的时候,不仅在屏幕滑动的过程中,而且在 momentum 滚动动画运行过程中实时派发 scroll 事件。
如果没有设置该值,其默认值为0 ,即不派发 scroll事件。
bounce: false关闭better-scroll滚动到最底部或者顶部的弹性效果(防止拉到顶部还可以继续往下拉 出来一块空白问题)
容器要有固定高度
fixed元素要放在容器外