Browse Source

去除情绪大模型内部滚动逻辑以解决移动端搜索股票后半滚动问题;

dev
宋杰 9 hours ago
parent
commit
43ee2b4903
  1. 26
      src/views/AiEmotion.vue
  2. 15
      src/views/homePage.vue

26
src/views/AiEmotion.vue

@ -2982,30 +2982,12 @@ const scrollToTop = () => {
const heightObserver = ref(null); const heightObserver = ref(null);
const isAutoScrollEnabled = ref(false); const isAutoScrollEnabled = ref(false);
//
// - emit
const scrollToBottom = () => { const scrollToBottom = () => {
// 使nextTickDOM // 使nextTickDOM
nextTick(() => { 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> </script>

15
src/views/homePage.vue

@ -500,6 +500,20 @@ const handleAiEmotionUserScroll = () => {
}, 2000); }, 2000);
}; };
// AiEmotion
const handleAiEmotionScrollToBottom = () => {
if (activeTab.value === 'AiEmotion') {
const container = tabContentAiEmotion.value;
if (container) {
// 使nextTickDOM
nextTick(() => {
container.scrollTop = container.scrollHeight - container.offsetHeight;
console.log("AiEmotion页面:执行容器滚动到底部");
});
}
}
};
// AiEmotion // AiEmotion
const stopAiEmotionHeightObserver = () => { const stopAiEmotionHeightObserver = () => {
isAiEmotionAutoScrollEnabled.value = false; isAiEmotionAutoScrollEnabled.value = false;
@ -1056,6 +1070,7 @@ onUnmounted(() => {
@sendMessage="sendMessage" @sendMessage="sendMessage"
@ensureAIchat="ensureAIchat" @ensureAIchat="ensureAIchat"
@enableInput="enableInput" @enableInput="enableInput"
@scrollToBottom="handleAiEmotionScrollToBottom"
ref="aiEmotionRef" ref="aiEmotionRef"
/> />
</div> </div>

Loading…
Cancel
Save