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-with-animation="true"
class="area-msg-list"
@scroll="handleScroll"
@scrolltolower="handleScrollToLower"
>
<!-- welcome栏 -->
<ChatTopWelcome
@@ -172,6 +174,9 @@ const isKeyboardShow = ref(false);
///(控制滚动位置)
const scrollTop = ref(99999);
// 用户滚动状态控制
const isUserScrolling = ref(false);
/// 会话列表
const chatMsgList = ref([]);
/// 输入口的输入消息
@@ -235,13 +240,21 @@ const handleKeyboardHide = () => {
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) => {