From 2de4d3548dc29c71ed88a87aec5fdd4565a4af7b Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Mon, 22 Sep 2025 23:06:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A6=96=E6=83=85=E6=B3=81=20=E8=87=AA?= =?UTF-8?q?=E5=8B=95=E6=BB=BE=E5=8B=95=E5=88=B0=E6=9C=80=E6=96=B0=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ui/chat/ChatFragment.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/ui/chat/ChatFragment.tsx b/client/ui/chat/ChatFragment.tsx index 7afca48..61a8b49 100644 --- a/client/ui/chat/ChatFragment.tsx +++ b/client/ui/chat/ChatFragment.tsx @@ -75,6 +75,11 @@ export default function ChatFragment({ target, ...props }: Args) { const { chat, msg } = (data as OnMessageData) if (target == chat) { setMessagesList(messagesList.concat([msg])) + if ((chatPanelRef.current!.scrollHeight - chatPanelRef.current!.scrollTop - chatPanelRef.current!.clientHeight) < 80) + setTimeout(() => chatPanelRef.current!.scrollTo({ + top: 10000000000, + behavior: "smooth", + }), 100) } }) return () => { @@ -96,11 +101,6 @@ export default function ChatFragment({ target, ...props }: Args) { }, 5000) if (checkApiSuccessOrSncakbar(re, "發送失敗")) return inputRef.current!.value = '' - - chatPanelRef.current!.scrollTo({ - top: 10000000000, - behavior: "smooth", - }) } return (