mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-06 08:32:51 +08:00
🚸 优化滚动处理,移除不必要的async/await
This commit is contained in:
@@ -118,18 +118,18 @@ watch(
|
||||
},
|
||||
);
|
||||
|
||||
async function handleListScroll(e: Event): Promise<void> {
|
||||
function handleListScroll(e: Event): void {
|
||||
const target = <HTMLElement>e.target;
|
||||
if (!target) return;
|
||||
// Emit event to close sub-reply menus when parent scrolls
|
||||
await emit("closeReplySub");
|
||||
emit("closeReplySub");
|
||||
// Check if scrolled to bottom for auto-load
|
||||
const scrollTop = target.scrollTop;
|
||||
const clientHeight = target.clientHeight;
|
||||
const scrollHeight = target.scrollHeight;
|
||||
if (scrollTop + clientHeight >= scrollHeight - 1) {
|
||||
if (!loading.value && !isLast.value) {
|
||||
await loadReply();
|
||||
loadReply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ async function listenCloseSub(): Promise<UnlistenFn> {
|
||||
});
|
||||
}
|
||||
|
||||
async function handleSubScroll(e: globalThis.Event): Promise<void> {
|
||||
function handleSubScroll(e: globalThis.Event): void {
|
||||
const target = <HTMLElement>e.target;
|
||||
if (!target) return;
|
||||
// Check if scrolled to bottom for auto-load
|
||||
@@ -190,7 +190,7 @@ async function handleSubScroll(e: globalThis.Event): Promise<void> {
|
||||
const scrollHeight = target.scrollHeight;
|
||||
if (scrollTop + clientHeight >= scrollHeight - 1) {
|
||||
if (!loading.value && !isLast.value) {
|
||||
await loadSub();
|
||||
loadSub();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user