fix(preview): 首页图片预览 - 复用画布查看器 (#448)
This commit is contained in:
27
web/src/components/canvas/canvas-image-preview.tsx
Normal file
27
web/src/components/canvas/canvas-image-preview.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Image } from "antd";
|
||||
|
||||
type CanvasImagePreviewProps = {
|
||||
src: string;
|
||||
alt?: string;
|
||||
onClose: () => void;
|
||||
};
|
||||
|
||||
export function CanvasImagePreview({ src, alt = "图片", onClose }: CanvasImagePreviewProps) {
|
||||
if (!src) return null;
|
||||
|
||||
return (
|
||||
<Image
|
||||
src={src}
|
||||
alt={alt}
|
||||
style={{ display: "none" }}
|
||||
preview={{
|
||||
open: true,
|
||||
movable: true,
|
||||
minScale: 0.5,
|
||||
maxScale: 12,
|
||||
scaleStep: 0.25,
|
||||
onOpenChange: (open) => !open && onClose(),
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user