ReachBottom时等list初始化好

This commit is contained in:
bob
2025-03-29 22:54:46 +08:00
parent 48387b74c7
commit 336d8a39d2

View File

@@ -603,14 +603,25 @@ const updateScroll = () => {
* @param behavior smooth 平滑的, instant 立即(默认)
*/
const msgListReachBottom = (behavior = 'instant') => {
setTimeout(() => {
msgListDiv.value?.scrollTo({
const scrollToBottom = () => {
msgListDiv.value.scrollTo({
top: msgListDiv.value.scrollHeight,
behavior: behavior
})
newMsgTips.value.isShowBottomTips = false
disToBottom.value = 0
}, 0)
}
if (msgListDiv.value) {
scrollToBottom()
} else {
const stopWatch = watch(msgListDiv, (newValue) => {
if (newValue) {
scrollToBottom()
stopWatch() // 停止监听
}
})
}
}
const onReturnBottom = () => {