-
Notifications
You must be signed in to change notification settings - Fork 30
Swipe Events
Drew Baker edited this page Apr 25, 2021
·
1 revision
To enable swipe event listeners on a given element use the function initSwipeEvents
located in utils/tools.js
.
The parameters to the initSwipeEvents
function are el the element which event listeners will be added to and deltaMin the minimum swipe distance required to fire a swipe event. The default value of deltaMin is 80.
The events emitted by this function are swipeUp
, swipeDown
, swipeRight
, swipeLeft
An example of a component:
import initSwipeEvents from "~/utils/initSwipeEvents"
<template>
<div
@swipe-right="foo"
@swipe-left="bar"
@swipe-up="foo"
@swipe-down="bar"
/>
</template>
<script>
export default {
mounted() {
// 80 is the default, you can leave it empty normally
initSwipeEvents(this.$el, 80)
}
}
</script>