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
+3 -32
View File
@@ -1,40 +1,11 @@
import { App, CSSProperties, TeleportProps } from 'vue';
import {
extend,
inBrowser,
withInstall,
Interceptor,
ComponentInstance,
} from '../utils';
import { extend, inBrowser, withInstall, ComponentInstance } from '../utils';
import { mountComponent, usePopupState } from '../utils/mount-component';
import { PopupCloseIconPosition } from '../popup';
import VanImagePreview from './ImagePreview';
import type { App } from 'vue';
import type { ImagePreviewOptions } from './types';
let instance: ComponentInstance;
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;
};
const defaultConfig: ImagePreviewOptions = {
loop: true,
images: [],