lanxin 3 月之前
父节点
当前提交
b294ecdf5d
共有 1 个文件被更改,包括 2 次插入2 次删除
  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);