From e4a69e3394b9a8c2ef8f5fdb9042e71c1b4b4fb0 Mon Sep 17 00:00:00 2001 From: shinya Date: Fri, 22 Aug 2025 00:07:00 +0800 Subject: [PATCH] Revert "fix: video card button cannot click" This reverts commit 5798a6c63b966500870e009e384c2e2e5417b571. --- src/components/VideoCard.tsx | 2 -- src/hooks/useLongPress.ts | 15 +++------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/components/VideoCard.tsx b/src/components/VideoCard.tsx index 31851a0..d8423f4 100644 --- a/src/components/VideoCard.tsx +++ b/src/components/VideoCard.tsx @@ -583,7 +583,6 @@ const VideoCard = forwardRef(function VideoCard {config.showCheckCircle && ( (function VideoCard {config.showHeart && ( { + (clientX: number, clientY: number) => { // 如果已经有活跃的手势,忽略新的开始 if (isActive.current) return; - // 检查是否点击的是按钮元素 - if (target && target instanceof Element) { - const isButton = target.closest('button, [role="button"], [data-role="button"], .cursor-pointer, svg, a'); - if (isButton) { - // 如果点击的是按钮,不启动长按计时器 - return; - } - } - isActive.current = true; isLongPress.current = false; startPosition.current = { x: clientX, y: clientY }; @@ -103,7 +94,7 @@ export const useLongPress = ({ (e: React.TouchEvent) => { // 阻止默认的长按行为,但不阻止触摸开始事件 const touch = e.touches[0]; - handleStart(touch.clientX, touch.clientY, e.target); + handleStart(touch.clientX, touch.clientY); }, [handleStart] ); @@ -129,7 +120,7 @@ export const useLongPress = ({ // 鼠标事件处理器(用于桌面端测试) const onMouseDown = useCallback( (e: React.MouseEvent) => { - handleStart(e.clientX, e.clientY, e.target); + handleStart(e.clientX, e.clientY); }, [handleStart] );