vue3-drag-directive
Version:
🪶 Lightweight Vue3 drag directive
45 lines (40 loc) • 1.2 kB
TypeScript
import { App } from 'vue';
declare const vDragList: {
/**
* 在组件挂载时调用,初始化拖拽列表
*
* @param el 挂载的DOM元素
* @param binding Vue指令的绑定值
*/
mounted(el: any, binding: any): void;
/**
* 当数据更新时触发的回调函数
*
* @param el DOM 元素
* @param binding Vue 指令绑定对象
*/
updated(el: any, binding: any): Promise<void>;
/**
* 卸载组件时调用的方法,用于移除拖拽列表的事件监听器
*
* @param el 需要卸载的DOM元素
*/
unmounted(el: any): void;
};
declare function registerDragList(app: any): void;
interface DragListItem {
id: string | number;
[key: string]: any;
}
interface DragListUpdateDetail {
updatedData: DragListItem[];
draggedItemData: DragListItem | null;
}
interface DragListPluginOptions {
name?: string;
}
declare const DragListPlugin: {
install(app: App, options?: DragListPluginOptions): void;
};
export { DragListPlugin as default, vDragList as dragListDirective, registerDragList, vDragList };
export type { DragListItem, DragListPluginOptions, DragListUpdateDetail };