Archived
feat: 优化 UseIntersectionObserverInfiniteLoading 组件的加载逻辑和模板结构
This commit is contained in:
1 parent
aa902ed159
commit
dbcc28fb42
1 file changed
+3
-4
@@ -65,11 +65,10 @@ const load = async (why?: string) => {
|
||||
try {
|
||||
const { hasMore } = await props.asyncLoad(++currentPage);
|
||||
state.value = hasMore ? 'loaded' : 'complete';
|
||||
if (hasMore) {
|
||||
if (hasMore && checkIsVisible(target.value!)) {
|
||||
await nextTick();
|
||||
if (checkIsVisible(target.value!)) {
|
||||
load('visible after load');
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 300));
|
||||
load('visible after load');
|
||||
}
|
||||
|
||||
if (!hasMore) {
|
||||
|
||||
Reference in new issue
Block a user