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 新事件回调 - 当收到新事件时智能刷新列表 *