Skip to content

Commit

Permalink
fix(ImagePreview): swipeItem may be undefined (#12818)
Browse files Browse the repository at this point in the history
  • Loading branch information
inottn committed Apr 25, 2024
1 parent 9dea0e9 commit 01183e1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/vant/src/image-preview/ImagePreviewItem.tsx
Expand Up @@ -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);
Expand Down

0 comments on commit 01183e1

Please sign in to comment.