lanxin 3 months ago
parent
commit
b294ecdf5d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/page/rank/index.tsx

+ 2 - 2
src/page/rank/index.tsx

@@ -49,11 +49,11 @@ const Rank = () => {
       }
     });
     // 一开始就滚到当前用户
-
-    setTimeout(() => {
+    const checkContainer = setInterval(() => {
       const container = document.querySelector(".rank-focus-item");
       if (container) {
         container.scrollIntoView({ behavior: "smooth", inline: "end", block: "nearest" });
+        clearInterval(checkContainer); // 找到后清除定时器
       }
     }, 200);