From ae3b9c822615ef11c49e633c4e04509d22c55e13 Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Wed, 24 Sep 2025 18:15:04 +0800 Subject: [PATCH] =?UTF-8?q?ui:=20=E4=BF=AE=E6=AD=A3=20Tab=20=E6=8C=87?= =?UTF-8?q?=E7=A4=BA=E6=A8=99=E9=A1=AF=E7=A4=BA=E4=B8=8D=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ui/chat/ChatFragment.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/client/ui/chat/ChatFragment.tsx b/client/ui/chat/ChatFragment.tsx index 75d8477..cc00335 100644 --- a/client/ui/chat/ChatFragment.tsx +++ b/client/ui/chat/ChatFragment.tsx @@ -41,11 +41,11 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC title: '加載中...' } as Chat) - const [tabItemSelected, setTabItemSelected] = React.useState('Chat') + const [tabItemSelected, setTabItemSelected] = React.useState('None') const tabRef = React.useRef(null) const chatPanelRef = React.useRef(null) useEventListener(tabRef, 'change', () => { - setTabItemSelected(tabRef.current?.value || "Chat") + tabRef.current != null && setTabItemSelected(tabRef.current!.value as string) }) useAsyncEffect(async () => { @@ -57,7 +57,15 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC return checkApiSuccessOrSncakbar(re, "對話錯誤") setChatInfo(re.data as Chat) - loadMore() + await loadMore() + + setTabItemSelected("Chat") + setTimeout(() => { + chatPanelRef.current!.scrollTo({ + top: 10000000000, + behavior: "smooth", + }) + }, 100) }, [target]) const page = React.useRef(0) @@ -131,7 +139,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC flexDirection: 'column', overflowY: 'auto', }} {...props}> - 設定 + Work in progress... + + )