feat(ai剧本): ai剧本页解决自动滚动到底部bug
This commit is contained in:
parent
19f29666a7
commit
5f326542b9
|
@ -530,16 +530,30 @@ export default {
|
||||||
scrollToBottom() {
|
scrollToBottom() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const query = uni.createSelectorQuery().in(this);
|
this.$nextTick(() => {
|
||||||
query.select('#scroll-bottom-anchor').boundingClientRect(data => {
|
const query = uni.createSelectorQuery()
|
||||||
if (data) {
|
query.select('.chat-content').boundingClientRect()
|
||||||
// Scroll to anchor element position
|
query.select('.message-wrapper-box').boundingClientRect()
|
||||||
uni.pageScrollTo({
|
query.exec(res => {
|
||||||
selector: '#scroll-bottom-anchor',
|
const scrollViewHeight = res[0].height
|
||||||
duration: 100
|
const scrollContentHeight = res[1].height
|
||||||
});
|
if (scrollContentHeight > scrollViewHeight) {
|
||||||
|
const scrollTop = scrollContentHeight - scrollViewHeight
|
||||||
|
this.scrollTop = scrollTop
|
||||||
}
|
}
|
||||||
}).exec();
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// 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);
|
}, 100);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue