feat: 优化 UseIntersectionObserverInfiniteLoading 组件的加载逻辑和模板结构
This commit is contained in:
@ -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