소스 검색

Merge pull request #20 from Junyan/master

bugfix: 在预览中删除图片,如果没有图片时无法关闭预览
MinJie 5 년 전
부모
커밋
ebe74e09d2
1개의 변경된 파일2개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 4
      src/components/VisibleAnimationHandle.tsx

+ 2 - 4
src/components/VisibleAnimationHandle.tsx

@@ -32,10 +32,8 @@ export default function VisibleAnimationHandle({ visible, currentImage, children
   }
 
   React.useEffect(() => {
-    if (!currentImage) {
-      return;
-    }
-    const originRef = currentImage.originRef;
+    const originRef = (currentImage || {}).originRef;
+    
     if (originRef && originRef.nodeType === 1) {
       // 获取触发时节点位置
       const { top, left, width, height } = originRef.getBoundingClientRect();