From 8e5264f305ba0e03496048e53e34c0c4bac5f52d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= Date: Mon, 29 Dec 2025 19:56:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BA=E5=9D=9B=E4=BA=A4=E6=B5=81=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forums/list/index.jsx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/forums/list/index.jsx b/src/forums/list/index.jsx index 756fed096..2e7618a80 100644 --- a/src/forums/list/index.jsx +++ b/src/forums/list/index.jsx @@ -42,6 +42,18 @@ function List(props) { 2: require('../image/icon4.png'), } + function init(updatedTags){ + const tagByState = updatedTags.filter(i=>i.title.includes(tagNameByState)) + setForumTagDetail(tagByState && !!tagByState.length ? tagByState[0] : updatedTags[0]); + if(tagByState && !tagByState.length) return + const targetDiv = document.getElementById("forums-list3-id"); + const targetDivRect = targetDiv.getBoundingClientRect(); + targetDiv && window.scrollTo({ + top: targetDivRect.top+window.screenY, + behavior: 'smooth' + }) + } + useEffect(() => { document.title = '论坛交流'; @@ -91,16 +103,14 @@ function List(props) { .then(updatedTags => { setForumTag(updatedTags); if (updatedTags.length > 0) { - const tagByState = updatedTags.filter(i=>i.title.includes(tagNameByState)) - setForumTagDetail(tagByState && !!tagByState.length ? tagByState[0] : updatedTags[0]); + init(updatedTags) } }) .catch(error => { // 降级处理 setForumTag(childrenTags); if (childrenTags.length > 0) { - const tagByState = updatedTags.filter(i=>i.title.includes(tagNameByState)) - setForumTagDetail(tagByState && !!tagByState.length ? tagByState[0] : updatedTags[0]); + init(childrenTags) } }); } @@ -171,7 +181,7 @@ function List(props) {
精华论坛
-
+
{/* 四个板块 */}
{forumTag.map((item, index) => {