/** 滚动状态数据 */ export interface ScrollState { scrollTop: number; scrollLeft: number; scrollWidth: number; scrollHeight: number; clientWidth: number; clientHeight: number; } /** 拖拽状态数据 */ export interface DragState { isDragging: boolean; startX: number; startY: number; startTop: number; startLeft: number; direction: 'vertical' | 'horizontal'; } export interface ScrollbarInstance { /** 触发滚动事件 */ handleScroll: () => void; /** 滚动到一组特定坐标 */ scrollTo: (options: ScrollToOptions | number, y?: number) => void; /** 设置滚动条到顶部的距离 */ setScrollTop: (scrollTop: number) => void; /** 设置滚动条到左边的距离 */ setScrollLeft: (scrollLeft: number) => void; /** 手动更新滚动条状态 */ update: () => void; /** 滚动条包裹的 ref 对象 */ wrapRef: HTMLElement; /** 保存当前滚动位置到缓存 */ savePosition: () => void; /** 从缓存恢复滚动位置 */ restorePosition: () => void; /** 清除位置缓存 */ clearPosition: () => void; /** 滚动状态数据*/ scrollState: ScrollState; /** 拖拽状态数据*/ dragState: DragState | null; } export type ScrollbarDirection = 'horizontal' | 'vertical' | 'both'; export type { ScrollbarProps, ScrollbarEmits } from './index.vue';