perf: scrollToBottom 改成 scrollToBottomIfAtBottom (#771)

This commit is contained in:
舜岳
2023-03-22 18:00:53 +08:00
committed by GitHub
parent b1d0056429
commit 31a84325d4
2 changed files with 5 additions and 5 deletions

View File

@@ -28,7 +28,7 @@ export function useScroll(): ScrollReturn {
const scrollToBottomIfAtBottom = async () => {
await nextTick()
if (scrollRef.value) {
const threshold = 50 // 阈值,表示滚动条到底部的距离阈值
const threshold = 100 // 阈值,表示滚动条到底部的距离阈值
const distanceToBottom = scrollRef.value.scrollHeight - scrollRef.value.scrollTop - scrollRef.value.clientHeight
if (distanceToBottom <= threshold)
scrollRef.value.scrollTop = scrollRef.value.scrollHeight