|
|
@ -2982,30 +2982,12 @@ const scrollToTop = () => { |
|
|
|
const heightObserver = ref(null); |
|
|
|
const isAutoScrollEnabled = ref(false); |
|
|
|
|
|
|
|
// 滚动到底部功能 |
|
|
|
// 滚动到底部功能 - 通过emit通知父组件进行容器滚动 |
|
|
|
const scrollToBottom = () => { |
|
|
|
// 使用nextTick确保DOM已更新 |
|
|
|
nextTick(() => { |
|
|
|
// 获取页面的总高度 |
|
|
|
const documentHeight = Math.max( |
|
|
|
document.body.scrollHeight, |
|
|
|
document.body.offsetHeight, |
|
|
|
document.documentElement.clientHeight, |
|
|
|
document.documentElement.scrollHeight, |
|
|
|
document.documentElement.offsetHeight |
|
|
|
); |
|
|
|
|
|
|
|
// 平滑滚动到页面底部 |
|
|
|
window.scrollTo({ |
|
|
|
top: documentHeight, |
|
|
|
behavior: "smooth", |
|
|
|
}); |
|
|
|
|
|
|
|
// 备用方案:直接设置滚动位置 |
|
|
|
setTimeout(() => { |
|
|
|
document.documentElement.scrollTop = documentHeight; |
|
|
|
document.body.scrollTop = documentHeight; |
|
|
|
}, 1000); |
|
|
|
// 通过emit事件通知父组件进行滚动 |
|
|
|
emit('scrollToBottom'); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
@ -3327,7 +3309,7 @@ onUnmounted(() => { |
|
|
|
}); |
|
|
|
|
|
|
|
// 声明组件可以触发的事件 |
|
|
|
const emit = defineEmits(["updateMessage", "sendMessage", "ensureAIchat", "enableInput"]); |
|
|
|
const emit = defineEmits(["updateMessage", "sendMessage", "ensureAIchat", "enableInput", "scrollToBottom"]); |
|
|
|
|
|
|
|
// 导出方法供外部使用(已在上方定义) |
|
|
|
</script> |
|
|
|