mobile tap event for vue.js
Install
npm i vue-mobile-tap
Project setup
v-tap
Register a global custom directive called import Vue from 'vue'import Tap from 'vue-mobile-tap'Vue.use(Tap) new Vue({ render: h => h(App)}).$mount('#app')
v-tap
register a locally instead directive called
Usage
Simple example
button
v-tap.once
v-tap.once
handler will only trigger once
button
v-tap.stop
event.stopPropagation()
click me
v-tap.prevent
event.preventDefault()
It also prevents point-through event happen | 防止点透事件触发
<!-- bottom_div and top_div is not the parent-child relationship, but top_div show on the top of bottom_div. If do not prevent top_div's default touchend event, the point-through event will happen. --> <!-- bottom_div 和 top_div 没有父子关系, 但是 top_div 在 bottom_div 的上面显示。 如果不阻止 top_div 的 touchend 事件,bottom_div 的 click 事件会在 top_div 消失后触发。 --> I'll hide when I'm clicked
v-tap="[tapBtn, args...]"
Example for pass arguments
button
Notice
when touch event is not supported, tap event handler arguments[0] is different
button
Contact
The project's website is located at https://github.com/Haycher/vue-mobile-tap.git Author: Haycher, Lyu (spring_falling@163.com)