From 0eead1227ddf0f39232e7f37ff3c3ba71fc2b1c1 Mon Sep 17 00:00:00 2001 From: wangcch Date: Wed, 30 Dec 2020 16:31:12 +0800 Subject: [PATCH] feat(Image): preview-src prop --- src/Image.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Image.tsx b/src/Image.tsx index 7a36c170..04268165 100644 --- a/src/Image.tsx +++ b/src/Image.tsx @@ -68,14 +68,15 @@ const ImageInternal: CompoundedComponent = ({ useMap, ...otherProps }) => { - const src = (preview as ImagePreviewType)?.src ?? imgSrc; const isCustomPlaceholder = placeholder && placeholder !== true; const { + src: previewSrc, visible: previewVisible = undefined, onVisibleChange: onPreviewVisibleChange = onInitialPreviewClose, getContainer: getPreviewContainer = undefined, mask: previewMask, }: ImagePreviewType = typeof preview === 'object' ? preview : {}; + const src = previewSrc ?? imgSrc; const isControlled = previewVisible !== undefined; const [isShowPreview, setShowPreview] = useMergedState(!!previewVisible, { value: previewVisible,