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
您应该使用@click.native.prevent
来避免传播,就像文档解释的那样: https ://v2.vuejs.org/v2/guide/events.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.