feat: 添加了滚动的标识方法

This commit is contained in:
2025-08-27 20:34:16 +08:00
parent 0e51fdcd69
commit a366e259da

View File

@@ -20,6 +20,8 @@
scroll-y scroll-y
:scroll-with-animation="true" :scroll-with-animation="true"
class="area-msg-list" class="area-msg-list"
@scroll="handleScroll"
@scrolltolower="handleScrollToLower"
> >
<!-- welcome栏 --> <!-- welcome栏 -->
<ChatTopWelcome <ChatTopWelcome
@@ -172,6 +174,9 @@ const isKeyboardShow = ref(false);
///(控制滚动位置) ///(控制滚动位置)
const scrollTop = ref(99999); const scrollTop = ref(99999);
// 用户滚动状态控制
const isUserScrolling = ref(false);
/// 会话列表 /// 会话列表
const chatMsgList = ref([]); const chatMsgList = ref([]);
/// 输入口的输入消息 /// 输入口的输入消息
@@ -235,13 +240,21 @@ const handleKeyboardHide = () => {
holdKeyboard.value = false; holdKeyboard.value = false;
}; };
// 处理用户滚动事件
const handleScroll = (e) => {
// 标记用户正在滚动
};
// 处理滚动到底部事件
const handleScrollToLower = () => {};
// 滚动到底部 - 优化版本,确保打字机效果始终可见 // 滚动到底部 - 优化版本,确保打字机效果始终可见
const scrollToBottom = () => { const scrollToBottom = () => {
nextTick(() => { nextTick(() => {
scrollTop.value = 99999; scrollTop.value = 99999;
// 强制触发滚动更新 // 强制触发滚动更新
setTimeout(() => { setTimeout(() => {
scrollTop.value = scrollTop.value + 1; scrollTop.value = scrollTop.value + Math.random();
}, 10); }, 10);
}); });
}; };
@@ -526,14 +539,8 @@ const initTypewriterManager = () => {
typewriterManager.setCallbacks({ typewriterManager.setCallbacks({
// 每个字符打字时的回调 // 每个字符打字时的回调
onCharacterTyped: (displayedContent) => { onCharacterTyped: (displayedContent) => {
// 立即滚动到底部,确保打字过程中始终可见 // 只有在用户没有滚动时才自动滚动到底部
nextTick(() => { scrollToBottom();
scrollTop.value = 99999;
// 双重保险,确保滚动生效
setTimeout(() => {
scrollTop.value = 99999 + Math.random();
}, 20);
});
}, },
// 内容更新时的回调 // 内容更新时的回调
onContentUpdate: (content) => { onContentUpdate: (content) => {