When I tap the screen, the function is called two times

47 Views Asked by At

When I tap the element, the callback function is called two times.

I did try with a click event and there are no problems

    <template>
    <div>
      <div v-on:click="tap()">Click</div>
      <a v-hammer:tap="tap">Tap</a>
    </div>
    </template>

    <script>
    export default{
      name: 'say',
      beforeUpdate(){
        console.log('beforeUpdate')
      },
      updated(){
        console.log('updated')
      },
      methods: {
        tap(){
          console.log('Say',Date())
        }
      }
    }
    </script>

I expect the callback function is called once

1

There are 1 best solutions below

0
César Gómez On

You should to use @click.native.prevent for avoid propagation, like docs explains: https://v2.vuejs.org/v2/guide/events.html