diff --git a/packages/vant/src/image-preview/ImagePreviewItem.tsx b/packages/vant/src/image-preview/ImagePreviewItem.tsx index 229cca488..15ed76f3a 100644 --- a/packages/vant/src/image-preview/ImagePreviewItem.tsx +++ b/packages/vant/src/image-preview/ImagePreviewItem.tsx @@ -255,6 +255,9 @@ export default defineComponent({ const checkClose = (event: TouchEvent) => { const swipeItemEl: HTMLElement = swipeItem.value?.$el; + + if (!swipeItemEl) return; + const imageEl = swipeItemEl.firstElementChild; const isClickOverlay = event.target === swipeItemEl; const isClickImage = imageEl?.contains(event.target as HTMLElement);