修复瀑布流加载出现错误

This commit is contained in:
lzyme.dev@gmail.com
2026-10-11 23:49:51 +08:00
parent fde1eadac9
commit 89ab8bcff8
2 changed files with 14 additions and 12 deletions
+6 -5
View File
@@ -3329,9 +3329,6 @@ ${value}\r
const nextLink = document.querySelector(selector.nextPageSelector); const nextLink = document.querySelector(selector.nextPageSelector);
this.nextUrl = null == nextLink ? void 0 : nextLink.href; this.nextUrl = null == nextLink ? void 0 : nextLink.href;
this.hasMore = !!this.nextUrl; this.hasMore = !!this.nextUrl;
setTimeout((() => {
this.checkLoad();
}), 1e3);
this.hasMore || this.setState("waterfall-no-more", "已经到底了"); this.hasMore || this.setState("waterfall-no-more", "已经到底了");
} }
async loadNextPage() { async loadNextPage() {
@@ -3403,7 +3400,9 @@ ${value}\r
clog.error("加载失败:", e); clog.error("加载失败:", e);
this.setState("waterfall-error", "加载失败,点击重试"); this.setState("waterfall-error", "加载失败,点击重试");
} finally { } finally {
setTimeout((() => {
this.isLoading = false; this.isLoading = false;
}), 600);
} }
} }
checkScrollPosition() { checkScrollPosition() {
@@ -3420,8 +3419,10 @@ ${value}\r
} }
} }
checkLoad() { checkLoad() {
if (!this.loader) return; if (!this.loader || this.isLoading || !this.hasMore) return;
this.loader.getBoundingClientRect().top < window.innerHeight + this.preloadDistance && this.loadNextPage().then(); if (window.scrollY < 100) return;
const triggerDistance = 200;
this.loader.getBoundingClientRect().top < window.innerHeight + triggerDistance && this.loadNextPage().then();
} }
async shouldDisablePaging() { async shouldDisablePaging() {
if (!window.isListPage) return true; if (!window.isListPage) return true;
+6 -5
View File
@@ -55,9 +55,6 @@ class AutoPagePlugin extends BasePlugin {
const nextLink = document.querySelector(selector.nextPageSelector); const nextLink = document.querySelector(selector.nextPageSelector);
this.nextUrl = null == nextLink ? void 0 : nextLink.href; this.nextUrl = null == nextLink ? void 0 : nextLink.href;
this.hasMore = !!this.nextUrl; this.hasMore = !!this.nextUrl;
setTimeout((() => {
this.checkLoad();
}), 1e3);
this.hasMore || this.setState("waterfall-no-more", "已经到底了"); this.hasMore || this.setState("waterfall-no-more", "已经到底了");
} }
async loadNextPage() { async loadNextPage() {
@@ -128,7 +125,9 @@ class AutoPagePlugin extends BasePlugin {
clog.error("加载失败:", e); clog.error("加载失败:", e);
this.setState("waterfall-error", "加载失败,点击重试"); this.setState("waterfall-error", "加载失败,点击重试");
} finally { } finally {
setTimeout((() => {
this.isLoading = !1; this.isLoading = !1;
}), 600);
} }
} }
checkScrollPosition() { checkScrollPosition() {
@@ -145,8 +144,10 @@ class AutoPagePlugin extends BasePlugin {
} }
} }
checkLoad() { checkLoad() {
if (!this.loader) return; if (!this.loader || this.isLoading || !this.hasMore) return;
this.loader.getBoundingClientRect().top < window.innerHeight + this.preloadDistance && this.loadNextPage().then(); if (window.scrollY < 100) return;
const triggerDistance = 200;
this.loader.getBoundingClientRect().top < window.innerHeight + triggerDistance && this.loadNextPage().then();
} }
async shouldDisablePaging() { async shouldDisablePaging() {
if (!window.isListPage) return !0; if (!window.isListPage) return !0;