Skip to content

useSwipe

基于 TouchEvents 的反应式滑动检测。

¥Reactive swipe detection based on TouchEvents.

示例

Swipe right

Direction: none
lengthX: 0 | lengthY: 0

用法

¥Usage

vue
<script setup lang="ts">
import { 
useSwipe
} from '@vueuse/core'
import {
useTemplateRef
} from 'vue'
const
el
=
useTemplateRef
('el')
const {
isSwiping
,
direction
} =
useSwipe
(
el
)
</script> <template> <
div
ref
="
el
">
Swipe here </
div
>
</template>