From 5f326542b9bf21f5385cb37a1fb71bcd42b09b07 Mon Sep 17 00:00:00 2001 From: fhysy <1149505133@qq.com> Date: Tue, 25 Mar 2025 16:23:56 +0800 Subject: [PATCH] =?UTF-8?q?feat(ai=E5=89=A7=E6=9C=AC):=20ai=E5=89=A7?= =?UTF-8?q?=E6=9C=AC=E9=A1=B5=E8=A7=A3=E5=86=B3=E8=87=AA=E5=8A=A8=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=E5=BA=95=E9=83=A8bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/fun/AiDrama.vue | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/pages/fun/AiDrama.vue b/pages/fun/AiDrama.vue index 99957a5..c0555c2 100644 --- a/pages/fun/AiDrama.vue +++ b/pages/fun/AiDrama.vue @@ -530,16 +530,30 @@ export default { scrollToBottom() { this.$nextTick(() => { setTimeout(() => { - const query = uni.createSelectorQuery().in(this); - query.select('#scroll-bottom-anchor').boundingClientRect(data => { - if (data) { - // Scroll to anchor element position - uni.pageScrollTo({ - selector: '#scroll-bottom-anchor', - duration: 100 - }); - } - }).exec(); + this.$nextTick(() => { + const query = uni.createSelectorQuery() + query.select('.chat-content').boundingClientRect() + query.select('.message-wrapper-box').boundingClientRect() + query.exec(res => { + const scrollViewHeight = res[0].height + const scrollContentHeight = res[1].height + if (scrollContentHeight > scrollViewHeight) { + const scrollTop = scrollContentHeight - scrollViewHeight + this.scrollTop = scrollTop + } + }) + }) + + // const query = uni.createSelectorQuery().in(this); + // query.select('#scroll-bottom-anchor').boundingClientRect(data => { + // if (data) { + // // Scroll to anchor element position + // uni.pageScrollTo({ + // selector: '#scroll-bottom-anchor', + // duration: 100 + // }); + // } + // }).exec(); }, 100); }); },