From ac421011ebe7dedf72d4a5e1e4fe7d6ac0c12cb5 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Thu, 4 Dec 2025 11:57:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E5=88=9A=E8=BF=9B=E9=A1=B5=E9=9D=A2=E5=90=91?= =?UTF-8?q?=E4=B8=8A=E6=BB=9A=E5=8A=A8=E4=BA=86=E4=B8=80=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Community/index.js | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/src/views/Community/index.js b/src/views/Community/index.js index 3059c6d0..073ce724 100644 --- a/src/views/Community/index.js +++ b/src/views/Community/index.js @@ -107,28 +107,6 @@ const Community = () => { } }, [events, loading, pagination, filters]); - // ⚡ 首次进入页面时滚动到内容区域(考虑导航栏高度) - const hasScrolled = useRef(false); - useEffect(() => { - // 只在第一次挂载时执行滚动 - if (hasScrolled.current) return; - - // 延迟执行,确保DOM已完全渲染 - const timer = setTimeout(() => { - if (containerRef.current) { - hasScrolled.current = true; - // 滚动到容器顶部,自动考虑导航栏的高度 - containerRef.current.scrollIntoView({ - behavior: 'auto', - block: 'start', - inline: 'nearest' - }); - } - }, 100); - - return () => clearTimeout(timer); - }, []); // 空依赖数组,只在组件挂载时执行一次 - /** * ⚡ 【核心逻辑】注册 Socket 新事件回调 - 当收到新事件时智能刷新列表 *