From a05faa2676efb41c44738f27c2e736c465b931b3 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期四, 03 四月 2025 16:41:24 +0800 Subject: [PATCH] conclusion 也要读 --- src/components/chat/hooks/useScroll.ts | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/chat/hooks/useScroll.ts b/src/components/chat/hooks/useScroll.ts index 55138ad..8e55dfc 100644 --- a/src/components/chat/hooks/useScroll.ts +++ b/src/components/chat/hooks/useScroll.ts @@ -10,11 +10,19 @@ export const useScroll = (option: UseScrollOption) => { const { chatListDom } = option; - + const scrollStepToBottom = () => { + const allStepList = document.querySelectorAll('.step-list'); + const lastStepList = allStepList[allStepList.length - 1]; + if (!lastStepList) return; + lastStepList.scrollTop = lastStepList.scrollHeight - lastStepList.clientHeight; + }; const scrollToBottom = () => { nextTick(() => { if (chatListDom.value.scrollHeight > chatListDom.value.clientHeight) { chatListDom.value.scrollTop = chatListDom.value.scrollHeight - chatListDom.value.clientHeight; + nextTick(() => { + scrollStepToBottom(); + }); } }); }; @@ -24,7 +32,6 @@ chatListDom.value.scrollTop = 0; }); }; - const checkIsBottom = () => { // 璇樊 2鍍忕礌 @@ -36,7 +43,7 @@ }); onUnmounted(() => { - chatListDom.value.removeEventListener('scrollend', checkIsBottom); + chatListDom.value?.removeEventListener('scrollend', checkIsBottom); }); // emitter.on('amis.page.ready', debounceAmisScroll); -- Gitblit v1.9.3