Vue-awesome-swiper: click event emit twice

Created on 7 Mar 2018  ·  3Comments  ·  Source: surmon-china/vue-awesome-swiper

https://github.com/surmon-china/vue-awesome-swiper/blob/df5fbd0b8e7f31bb4fc4cee365199bdc35ed682c/src/swiper.vue#L150

bindEvents() {
        const vm = this
        DEFAULT_EVENTS.forEach(eventName => {
          this.swiper.on(eventName, function() {
           // here click or tap event will be emit twice 
            vm.$emit(eventName, ...arguments)
            vm.$emit(eventName.replace(/([A-Z])/g, '-$1').toLowerCase(), ...arguments)
          })
        })
      }

Most helpful comment

@cycold I had a similar issue with a @click event being emitted 3 times, and fixed it by using @click.native="myMethod()"

All 3 comments

如果是在 Webpack 的项目中,使用驼峰事件名称监听。

@cycold I had a similar issue with a @click event being emitted 3 times, and fixed it by using @click.native="myMethod()"

Hello.
same problem with @tap or @click event,

<swiper ref="mySwiper" @tap="myTapEvent">
methods: {
    myTapEvent(event) {
      console.log(event) // => emitted twice...
    }
}

and i don't understand how #286 @weineel fix this issue?

Any ideas?

Was this page helpful?
0 / 5 - 0 ratings