问题说明

<div class="info_box" @touchstart="start" @touchmove='move' @touchend='end'></div>

touchstart touchend都可以触发 touchmove不可触发

问题解决

在start(e){}方法里打印e.cancelable e.defaultPrevented

start (e) {
  console.log(e.cancelable)
  console.log(e.defaultPrevented)
}

结果为 true false ,表明没有禁用默认事件
在start中添加e.preventDefault(),禁用默认事件
问题解决

start (e) {
  e.preventDefault()
}

然后会报错
应用 CSS 属性 touch-action: none; 这样任何触摸事件都不会产生默认行为,但是 touch 事件照样触发

参考:https://blog.csdn.net/lijingshan34/article/details/88350456

相关文章:

  • 2021-08-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
猜你喜欢
  • 2021-07-24
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案