import React from 'react'; import { DownloadOutlined, LeftOutlined, RightOutlined, RotateLeftOutlined, RotateRightOutlined, SwapOutlined, UndoOutlined, ZoomInOutlined, ZoomOutOutlined, } from '@ant-design/icons'; import { Image, Space } from 'antd'; const imageList = [ 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg', 'https://gw.alipayobjects.com/zos/antfincdn/aPkFc8Sj7n/method-draw-image.svg', ]; // you can download flipped and rotated image // https://codesandbox.io/s/zi-ding-yi-gong-ju-lan-antd-5-7-0-forked-c9jvmp const App: React.FC = () => { const [current, setCurrent] = React.useState(0); // or you can download flipped and rotated image // https://codesandbox.io/s/zi-ding-yi-gong-ju-lan-antd-5-7-0-forked-c9jvmp const onDownload = () => { const url = imageList[current]; const suffix = url.slice(url.lastIndexOf('.')); const filename = Date.now() + suffix; fetch(url) .then((response) => response.blob()) .then((blob) => { const blobUrl = URL.createObjectURL(new Blob([blob])); const link = document.createElement('a'); link.href = blobUrl; link.download = filename; document.body.appendChild(link); link.click(); URL.revokeObjectURL(blobUrl); link.remove(); }); }; return ( ( onActive?.(-1)} /> onActive?.(1)} /> ), onChange: (index) => { setCurrent(index); }, }} > {imageList.map((item) => ( ))} ); }; export default App;