Vue-awesome-swiper: [Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.

Created on 12 Oct 2018  ·  15Comments  ·  Source: surmon-china/vue-awesome-swiper

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

Vue.js version and component version

  • vue-cli 3.0.1
  • vue 2.5.17
  • vue-awesome-swiper 3.1.3

Steps to reproduce

Global registration
import VueAwesomeSwiper from 'vue-awesome-swiper'

// require styles
import 'swiper/dist/css/swiper.css'

Vue.use(VueAwesomeSwiper, /* { default global options } */)
Component code
<!-- The ref attr used to find the swiper instance -->
<template>
  <swiper :options="swiperOption" ref="mySwiper">
    <!-- slides -->
    <swiper-slide>I'm Slide 1</swiper-slide>
    <swiper-slide>I'm Slide 2</swiper-slide>
    <swiper-slide>I'm Slide 3</swiper-slide>
    <swiper-slide>I'm Slide 4</swiper-slide>
    <swiper-slide>I'm Slide 5</swiper-slide>
    <swiper-slide>I'm Slide 6</swiper-slide>
    <swiper-slide>I'm Slide 7</swiper-slide>
  </swiper>
</template>

<script>
  export default {
    name: 'carrousel',
    data() {
      return {
        swiperOption: {
          // some swiper options/callbacks
          // 所有的参数同 swiper 官方 api 参数
          // ...
        }
      }
    },
    computed: {
      swiper() {
        return this.$refs.mySwiper.swiper
      }
    },
    mounted() {
      // current swiper instance
      // 然后你就可以使用当前上下文内的swiper对象去做你想做的事了
      console.log('this is current swiper instance object', this.swiper)
      this.swiper.slideTo(3, 1000, false)
    }
  }
</script>

It can still trigger a slide when it is about 5-10 pixels beneath the swiper component, and the following error is reported in the console

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

What is Expected?

He shouldn't be executed when sliding a component, because the sliding is out of the scope of the component, and the swiper parent element can see overflow: hidden; when I've looked through a lot of data and couldn't find the right answer, I think I should be here to find the answer

What is actually happening?

It may seem like an insignificant problem for a component, but it's unusual for him to be able to slide underneath and out of the component so he can trigger the slide.

Most helpful comment

给html元素添加一个css3属性

touch-action: none;

即可解决这个问题

All 15 comments

给html元素添加一个css3属性

touch-action: none;

即可解决这个问题

2018-10-24_230830
我试过了这种方法,但是它依然会报错

给HTML元素添加一个CSS3属性

touch-action: none;

即可解决这个问题

我使用这个方法解决了问题

hi,
my app still error like that

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

i added in vuejs app.js

<style scoped>
html, body { touch-action: none }
</style>

but still error

2018-10-24_230830
我试过了这种方法,但是它依然会报错

是给HTML元素添加:

html {
  touch-action: none;
}

不过需要注意的是,添加了 touch-action: none之后页面滚动可能有问题,慎用

hi,
my app still error like that

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

i added in vuejs app.js

<style scoped>
html, body { touch-action: none }
</style>


but still error

try

html {
  touch-action: none;
}

but it make cause a problem with the page scrolling in Android,caution while using

hi,
my app still error like that

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

i added in vuejs app.js

but still error

try

html {
touch-action: none;
}
but it make cause a problem with the page scrolling in Android,caution while using

因为最近一段时间比较忙没有顾得上这个问题,现在又遇到了,所以我自己尝试了直接修改swiper源文件1876行,将这段阻止默认事件的代码注释掉了,也不会报错,滑动底部接近于边缘的地方也不会触发swiper的滑动事件了,看起来好像正常了,然后测试了安卓与苹果,都很正常

swiper.allowClick = false;
// e.preventDefault();
if (params.touchMoveStopPropagation && !params.nested) {
  e.stopPropagation();
}

hi,
my app still error like that

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

i added in vuejs app.js

but still error

try

html {
touch-action: none;
}
but it make cause a problem with the page scrolling in Android,caution while using

mmm i still dont understand

hi,
my app still error like that
[Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
i added in vuejs app.js

but still error
try
html {
touch-action: none;
}
but it make cause a problem with the page scrolling in Android,caution while using

因为最近一段时间比较忙没有顾得上这个问题,现在又遇到了,所以我自己尝试了直接修改swiper源文件1876行,将这段阻止默认事件的代码注释掉了,也不会报错,滑动底部接近于边缘的地方也不会触发swiper的滑动事件了,看起来好像正常了,然后测试了安卓与苹果,都很正常

swiper.allowClick = false;
// e.preventDefault();
if (params.touchMoveStopPropagation && !params.nested) {
  e.stopPropagation();
}

where functions is?
so, there's any bug fixed from code in new version?

hi,
my app still error like that
[Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
i added in vuejs app.js

but still error
try
html {
touch-action: none;
}
but it make cause a problem with the page scrolling in Android,caution while using

mmm i still dont understand

hi,
my app still error like that
[Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
i added in vuejs app.js

but still error
try
html {
touch-action: none;
}
but it make cause a problem with the page scrolling in Android,caution while using

因为最近一段时间比较忙没有顾得上这个问题,现在又遇到了,所以我自己尝试了直接修改swiper源文件1876行,将这段阻止默认事件的代码注释掉了,也不会报错,滑动底部接近于边缘的地方也不会触发swiper的滑动事件了,看起来好像正常了,然后测试了安卓与苹果,都很正常

swiper.allowClick = false;
// e.preventDefault();
if (params.touchMoveStopPropagation && !params.nested) {
  e.stopPropagation();
}

where functions is?
so, there's any bug fixed from code in new version?

image
我这里是better-scroll 依赖的swiper版本的2759行

注释掉可以正常

安卓ios运行正常 我暂时没发现有任何问题

但是不代表他是有问题的,这个只是我提出来的一种旁门的方法吧,毕竟报更新后都需要修改,很费事,touch-action: none加在html标签上我也试过,依然会出现问题,所以这个可能会解决吧,毕竟我只是一个小小的程序员,只是混口饭吃

please, till now, i still cannot fix this problem

try to add attribute “ontouchstart” at the body tag. like this:
mu ub b7g 1 ivbflz 8d

e.cancelable && e.preventDefault()

try to add attribute “ontouchstart” at the body tag. like this:
mu ub b7g 1 ivbflz 8d
It worked

You can try add cssMode: true in option

You can try add cssMode: true in option

Same, the problem still persists

try to add attribute “ontouchstart” at the body tag. like this:
mu ub b7g 1 ivbflz 8d

thanks, it works.

Was this page helpful?
0 / 5 - 0 ratings