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.