this.contentScroll = new BScroll(this.$refs.contentWrap,{
probeType:3,//探針,獲取滑動距離必備
click:true
});
//然后通過
this.contentScroll.on('scroll',(pos)=>{
this.scrollY = Math.abs(Math.round(pos.y));
});
//但在vue中有個奇怪的坑
//如果不這樣做,獲取的滑動距離始終為0?
if(this.contentScroll){
this.contentScroll.refresh();
}else {
this.contentScroll = new BScroll(this.$refs.contentWrap,{
probeType:3,
click:true
});
}
//好吧,我明白了,是這行代碼造的坑
this.contentScroll.refresh();//此處寫在重置中
