types(ImagePreview): add ImagePreviewInstance type (#9216)

This commit is contained in:
neverland
2021-08-09 17:49:24 +08:00
committed by GitHub
parent 2596166e95
commit e2a1d1ef32
6 changed files with 134 additions and 83 deletions
+46
View File
@@ -0,0 +1,46 @@
import type {
CSSProperties,
TeleportProps,
ComponentPublicInstance,
} from 'vue';
import type { Interceptor } from '../utils';
import type { SwipeToOptions } from '../swipe';
import type { PopupCloseIconPosition } from '../popup';
import type { ImagePreviewProps } from './ImagePreview';
export type ImagePreviewOptions = {
loop?: boolean;
images: string[];
maxZoom?: number;
minZoom?: number;
teleport?: TeleportProps['to'];
className?: unknown;
showIndex?: boolean;
closeable?: boolean;
closeIcon?: string;
transition?: string;
beforeClose?: Interceptor;
overlayStyle?: CSSProperties;
swipeDuration?: number;
startPosition?: number;
showIndicators?: boolean;
closeOnPopstate?: boolean;
closeIconPosition?: PopupCloseIconPosition;
onClose?(): void;
onScale?(args: { scale: number; index: number }): void;
onChange?(index: number): void;
};
export type ImagePreviewScaleEventParams = {
scale: number;
index: number;
};
export type ImagePreviewExpose = {
swipeTo: (index: number, options?: SwipeToOptions) => void;
};
export type ImagePreviewInstance = ComponentPublicInstance<
ImagePreviewProps,
ImagePreviewExpose
>;