1.0.4 • Published 6 years ago

vue2x-touch v1.0.4

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

vue2x-touch

This is a directive wrapper for Hammer.js 2.0

Install

# install dependencies
npm install vue2x-touch --save

Usage

ES6

import Vue2Touch from 'vue2x-touch'
Vue.use(Vue2Touch)

Using the v-touch directive

<a v-touch:tap="callback">Tap me!</a>
<div v-touch:swipe="callback">Swipe me!</div>
<div v-touch:pan="{callback:callback,data:data}">Swipe me!</div>


callback(e,el,data){
	console.log(e)//ev
	console.log(el)//Current Element 
	ocnsole.log(data)//{callback:fn,data:data}
}

Registering Custom Events

// example registering a custom doubletap event.
// the `type` indicates the base recognizer to use from Hammer
// all other options are Hammer recognizer options.
VueTouch.registerCustomEvent('doubletap', {
  type: 'tap',
  taps: 2
})
<a v-touch:doubletap="onDoubleTap"></a>

More Details

See Hammer.js document

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago