bertterScroll移动端一些配置

_initScroll() {
  if (!this.$refs.wrapper) {
    return
  }
//bertterScroll禁用所有元素的click,可用这个方法preventDefaultException解开

  this.scroll = new BScroll(this.$refs.wrapper, {
    probeType: this.probeType,
    click: this.click,
    eventPassthrough: 'horizontal',
    mouseWheel: true,
    scrollX: true,
    preventDefaultException: {tagName: /^(IMG|INPUT|TEXTAREA|BUTTON|SELECT|SPAN)$/}//标签可以用原生click了
  });


  this.scrollEvents.$on('scrollTo',(msg)=>{
    this.scroll.scrollTo(0,msg,800)
  });
 
 
//禁用浏览器的默认行为,ios微信端页面被整体拖动的问题,
passive: false可以兼容安卓与ios
document.addEventListener('touchmove', function (e) {
  //取消事件的默认动作
  e.preventDefault();
}, {passive: false})

猜你喜欢

转载自blog.csdn.net/qq_28473733/article/details/80165799