Skip to content

useDraggableDistance

获取拖拽距离

演示

示例

vue
<template>
  <
div
ref
="
targetRef
"
:
style
="{
transform
: `translate(${
x
}px, ${
y
}px)` }">
... </
div
>
</template> <script lang="ts" setup> import {
ref
} from 'vue';
import {
useDraggableDistance
} from '@mixte/use';
const
targetRef
=
ref
();
const {
x
,
y
,
isDragging
} =
useDraggableDistance
(
targetRef
);
</script>

Released under the MIT License.