vue-gesture
gesture events plugin for Vue.js 2. You can v-gesture directive,and directive auguments can use a tap, swipe, touchstart etc.When you are in the use of the PC,"tap, longtap, touchstart" Will automatically be converted to "click".
- tap — fires when the element is tapped.
- doubleTap — this pair of events can be used to detect double taps on the same element
- longTap — fires when an element is tapped and the finger is held down for more than 750ms.
- swipe, swipeLeft, swipeRight, swipeUp, swipeDown — fires when an element is swiped
- touchstart touchmove touchend click- These equivalent to touch the primary event
Install
CommonJS
-
Available through npm as
vue-gesture
.var VueGesture =Vue
Direct include
- You can also directly include it with a
<script>
tag when you have Vue already included globally. It will automatically install itself, and will add a globalvueGesture
.
Usage
v-gesture
directive
Using the touchstarttouchmovetouchendtapdoubleTaplongTapswipeswipeLeftswipeRightswipeUpswipeDownclick
Configuring Recognizer Options
There are two ways to customize recognizer options such as direction
and threshold
. The first one is setting global options:
// change the configvueGestureconfig =maxSingleTapTimeInterval: 200
Registering Custom Events
See /example
for a multi-event demo. To build it, run npm install && npm run build
.
License
MIT