From a366e259da60908481e79565f36d637f0ce2b701 Mon Sep 17 00:00:00 2001 From: zoujing Date: Wed, 27 Aug 2025 20:34:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E7=9A=84=E6=A0=87=E8=AF=86=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/chat/ChatMainList.vue | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/pages/chat/ChatMainList.vue b/pages/chat/ChatMainList.vue index 4c91141..0e49d0c 100644 --- a/pages/chat/ChatMainList.vue +++ b/pages/chat/ChatMainList.vue @@ -20,6 +20,8 @@ scroll-y :scroll-with-animation="true" class="area-msg-list" + @scroll="handleScroll" + @scrolltolower="handleScrollToLower" > { holdKeyboard.value = false; }; +// 处理用户滚动事件 +const handleScroll = (e) => { + // 标记用户正在滚动 +}; + +// 处理滚动到底部事件 +const handleScrollToLower = () => {}; + // 滚动到底部 - 优化版本,确保打字机效果始终可见 const scrollToBottom = () => { nextTick(() => { scrollTop.value = 99999; // 强制触发滚动更新 setTimeout(() => { - scrollTop.value = scrollTop.value + 1; + scrollTop.value = scrollTop.value + Math.random(); }, 10); }); }; @@ -526,14 +539,8 @@ const initTypewriterManager = () => { typewriterManager.setCallbacks({ // 每个字符打字时的回调 onCharacterTyped: (displayedContent) => { - // 立即滚动到底部,确保打字过程中始终可见 - nextTick(() => { - scrollTop.value = 99999; - // 双重保险,确保滚动生效 - setTimeout(() => { - scrollTop.value = 99999 + Math.random(); - }, 20); - }); + // 只有在用户没有滚动时才自动滚动到底部 + scrollToBottom(); }, // 内容更新时的回调 onContentUpdate: (content) => {