Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(imagepreview): 阻止冒泡,防止点击图片关闭 #2281

Merged
merged 2 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/packages/imagepreview/imagepreview.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ export const ImagePreview: FunctionComponent<Partial<ImagePreviewProps>> = (
}
const closeOnImg = (e: ITouchEvent | React.MouseEvent) => {
// 点击内容区域的图片是否可以关闭弹层(视频区域由于nut-video做了限制,无法关闭弹层)
e.stopPropagation()
Alex-huxiyang marked this conversation as resolved.
Show resolved Hide resolved
if (closeOnContentClick) {
onCloseInner(e)
}
Expand Down
1 change: 1 addition & 0 deletions src/packages/imagepreview/imagepreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@
}

const closeOnImg = (e: React.MouseEvent<Element, MouseEvent>) => {
e.stopPropagation()

Check warning on line 257 in src/packages/imagepreview/imagepreview.tsx

View check run for this annotation

Codecov / codecov/patch

src/packages/imagepreview/imagepreview.tsx#L257

Added line #L257 was not covered by tests
// 点击内容区域的图片是否可以关闭弹层(视频区域由于nut-video做了限制,无法关闭弹层)
if (closeOnContentClick) {
onCloseInner(e)
Expand Down
Loading