feat(ai剧本): ai剧本页解决自动滚动到底部bug
This commit is contained in:
parent
19f29666a7
commit
5f326542b9
|
@ -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);
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue