Skip to content

useDraggableDistance ​

获取拖拽距离

演示 ​

示例 ​

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

完整示例 ​

模拟拖拽移动滚动条 ​

Released under the MIT License.