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