From 06c5b6fa62acf411d33e61889482e3de5bca07d6 Mon Sep 17 00:00:00 2001 From: xueyinfei <1207092115@qq.com> Date: Wed, 31 Dec 2025 11:45:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A9=E6=89=8B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vue-fastapi-frontend/src/views/aichat/aichat.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/vue-fastapi-frontend/src/views/aichat/aichat.vue b/vue-fastapi-frontend/src/views/aichat/aichat.vue index 6dd4aa6..b651fe9 100644 --- a/vue-fastapi-frontend/src/views/aichat/aichat.vue +++ b/vue-fastapi-frontend/src/views/aichat/aichat.vue @@ -296,6 +296,7 @@ const { proxy } = getCurrentInstance(); const aiChatRef = ref() const quickInputRef = ref() const scrollDiv = ref() +const scorll = ref(true) const dialogScrollbar = ref() const loading = ref(false) const inputValue = ref('') @@ -388,6 +389,14 @@ const getMaxHeight = () => { const handleScrollTop = ($event) => { scrollTop.value = $event.scrollTop + if ( + dialogScrollbar.value.scrollHeight - (scrollTop.value + scrollDiv.value.wrapRef.offsetHeight) <= + 30 + ) { + scorll.value = true + } else { + scorll.value = false + } emit('scroll', { ...$event, dialogScrollbar: dialogScrollbar.value, scrollDiv: scrollDiv.value }) } @@ -396,9 +405,9 @@ const handleScroll = () => { // 内部高度小于外部高度 就需要出滚动条 if (scrollDiv.value.wrapRef.offsetHeight < dialogScrollbar.value.scrollHeight) { // 如果当前滚动条距离最下面的距离在 规定距离 滚动条就跟随 - // if (scorll.value) { + if (scorll.value) { scrollDiv.value.setScrollTop(getMaxHeight()) - // } + } } } }