vue使用swiper模块滑动时报错:[Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example becaus

时间:2024-08-17 21:02:50

报错:

vue使用swiper模块滑动时报错:[Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example becaus

vue报这个错
[Intervention] Ignored attempt to cancel a touchmove event with
cancelable=false, for example because scrolling is in progress and cannot be interrupted

方案1:使用css3

touch-action: none;

属性:

touch-action :当你触摸并按住触摸目标时候,禁止或显示系统默认菜单。
touch-action取值有一下两种
none:系统默认菜单被禁用
default:系统默认菜单不被禁用

方案2:修改源文件

找到 swiper原文件,node_modules=》swiper 下面的 swiper.js,第2795行 屏蔽  // e.preventDefault();,不再报错了。

swiper.allowClick = false;

// e.preventDefault();

if (params.touchMoveStopPropagation && !params.nested) {

e.stopPropagation();

}

.