今天,在解决微信内部vue页面拖拽冲突的时候(感谢微信浏览器拖动出现黑色/白色背景、网址问题解决方案提供的方案)使用e.preventDefault();的时候,代码报错:
[Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
网上的解决方案基本上都是使用 { touch-action: none; }样式,但这种治标不治本,而且会使得原先可以滑动的控件失去了滑动特性。
经过一番研究,可以使用如下方式进行异常的处理:
if (e.cancelable) {
e.preventDefault();
}