vue touchmove无法触发

问题说明

<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

原文地址:https://www.cnblogs.com/yad123/p/13797825.html