From bf457c6853760cafe22c730b50049de0d537ade4 Mon Sep 17 00:00:00 2001 From: sijinhui Date: Mon, 30 Sep 2024 14:31:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E5=8A=A8=E7=94=BBbug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=8C=E5=8F=8A=E4=B8=9D=E6=BB=91=E4=B8=80?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/chat.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 29091aced..c50905d2e 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -438,14 +438,23 @@ function useScrollToBottom( if (dom) { requestAnimationFrame(() => { setAutoScroll(true); - dom.scrollTo(0, dom.scrollHeight); + // dom.scrollTo(0, dom.scrollHeight); + // 丝滑一点 + dom.scrollTo({ + top: dom.scrollHeight, + behavior: "smooth", + }); }); } } // auto scroll useEffect(() => { - if (autoScroll && !detach) { + // if (autoScroll && !detach) { + // scrollDomToBottom(); + // } + // 自动滚动一直有bug,直接强制修改了 + if (autoScroll) { scrollDomToBottom(); } });