import { Image, Swiper, SwiperItem, View } from '@tarojs/components'; import React, { Fragment, useState } from 'react'; interface IImagesViewerProps { /** 图片列表 */ images: string[]; /** 当前所在滑块的 index */ current?: number; /** 取消事件 */ onCancel: () => void; } /** * 图片/图文查看组件 */ const ImagesViewer: React.FC = ({ images = [], current = 0, onCancel = () => {}, }) => { const [num, setNum] = useState(current); return ( onCancel()}> {images?.length > 0 && ( {num + 1}/{images?.length || 1} setNum(e.detail.current)} className='images' circular current={current}> {images.map((image, index) => ( ))} )} ); }; export default ImagesViewer;