tdesign-mobile-vue
Version:
tdesign-mobile-vue
29 lines (28 loc) • 958 B
TypeScript
import type { ComputedRef, Ref, MaybeRef } from 'vue';
declare type Position = {
x: number;
y: number;
};
export declare type UseSwipeDirection = 'up' | 'down' | 'left' | 'right' | 'none';
export interface UseSwipeOptions {
threshold?: number;
listenerOptions?: boolean | {
passive?: boolean;
capture?: boolean;
};
onSwipeStart?: (e: TouchEvent) => void;
onSwipe?: (e: TouchEvent) => void;
onSwipeEnd?: (e: TouchEvent, direction: UseSwipeDirection) => void;
}
export interface UseSwipeReturn {
isPassiveEventSupported: boolean;
isSwiping: Ref<boolean>;
direction: ComputedRef<UseSwipeDirection>;
coordsStart: Readonly<Position>;
coordsEnd: Readonly<Position>;
lengthX: ComputedRef<number>;
lengthY: ComputedRef<number>;
stop: () => void;
}
export declare function useSwipe(target: MaybeRef<EventTarget | null | undefined>, options?: UseSwipeOptions): UseSwipeReturn;
export {};