add vitepress doc

This commit is contained in:
Timi
2026-09-21 15:32:12 +08:00
parent 2fc96083c4
commit efd683e808
81 changed files with 7319 additions and 90 deletions
+11
View File
@@ -1,5 +1,6 @@
import type { Directive, DirectiveBinding } from "vue";
/** 拖拽指令的配置:按下、拖动、释放三个阶段各自可挂钩子,只有 onDragging 是必填。 */
export type DraggableConfig = {
/** 点下 */
@@ -35,6 +36,16 @@ const getEventPosition = (e: MouseEvent | TouchEvent): { clientX: number, client
return { clientX: 0, clientY: 0, pageX: 0, pageY: 0 };
};
/**
* ### 拖拽指令
*
* 同时支持鼠标与触控,按下后把移动过程交给回调,指令本身不移动元素,
* 位置如何应用由业务方决定。元素会被设置 `touch-action: none`。
*
* ```html
* <div v-draggable="{ onDragging: (e, relX, relY) => { ... } }"></div>
* ```
*/
const VDraggable: Directive = {
// 挂载
mounted(el: HTMLElement, binding: DirectiveBinding<DraggableConfig>) {