/* eslint-disable eqeqeq */ import { useModel } from '@umijs/max'; import { Image } from 'antd'; import { useRef,useState } from 'react'; function Limit({ content, style={} }) { const [preview, setpreview] = useState({ visible: false, }); const containerRef = useRef(); const handleClick = (e) => { if (e.target.tagName !== 'IMG') { return; } let srcarr = [], current = 0; if (containerRef?.current) { const imgTags = containerRef.current.querySelectorAll('img'); srcarr = Array.from(imgTags)?.map((el, i) => { if (el.src === e.target.src) { current = i + 1; } return el.src; }); } setpreview((s) => ({ current: current, urls: srcarr, visible: true, })); }; return (
setpreview((s) => ({ ...s, visible: vis, })), }} > {preview?.urls?.map?.((it) => ( ))}
); } export default Limit;