feat(ai剧本): ai剧本页解决自动滚动到底部bug

This commit is contained in:
fhysy 2025-03-25 16:23:56 +08:00
parent 19f29666a7
commit 5f326542b9
1 changed files with 24 additions and 10 deletions

View File

@ -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);
});
},