@nutui/nutui-react-taro
Version:
京东风格的轻量级移动端 React 组件库,支持一套代码生成 H5 和小程序
97 lines (96 loc) • 2.06 kB
TypeScript
import { FunctionComponent, ReactNode } from 'react';
import { BasicComponent } from '../../utils/typings';
export type ImagePreviewCloseIconPosition = 'top-right' | 'top-left' | 'bottom';
export interface ImageOption {
src: string;
index?: number;
}
export interface VideoOption {
source: {
src: string;
type: string;
};
options: {
muted: boolean;
controls: boolean;
};
index?: number;
}
export interface ImagePreviewProps extends BasicComponent {
/**
* 预览图片数组
* @default []
*/
images: Array<ImageOption>
/**
* 预览的视频数组(视频自动放到图片之前)
* @default []
*/
videos: Array<VideoOption>
/**
* 是否展示预览图片
* @default false
*/
visible: boolean
/**
* 自动轮播时长,0表示不会自动轮播
* @default 3000
*/
autoPlay: boolean
/**
* 页码,受控
* @default 1
*/
value?: number
/**
* 初始页码
* @default 1
*/
defaultValue: number
/**
* 点击图片可以退出预览
* @default false
*/
closeOnContentClick: boolean
/**
* 分页是否展示
* @default true
*/
pagination: boolean
/**
* 分页指示器是否展示
* @default false
*/
indicator: boolean
/**
* 分页指示器选中的颜色
* @default #fff
*/
indicatorColor: string
/**
* 关闭按钮
* @default false
*/
closeIcon: boolean | ReactNode
/**
* 关闭按钮位置
* @default top-right
*/
closeIconPosition: ImagePreviewCloseIconPosition
/**
* 开启长按图片显示识别小程序码菜单
* @default false
*/
showMenuByLongpress: boolean
/**
* 切换时触发
* @default -
*/
onChange: (value: number) => void
/**
* 点击遮罩关闭图片预览时触发
* @default -
*/
onClose: () => void
}
export declare const ImagePreview: FunctionComponent<Partial<ImagePreviewProps>>;