feat: 更新无限加载组件,添加刷新功能和错误处理,优化加载状态管理
Some checks failed
/ playwright (push) Failing after 1s
/ depcheck (push) Failing after 2s
/ build-and-deploy-to-vercel (push) Failing after 11s

This commit is contained in:
严浩
2024-12-08 16:53:50 +08:00
parent cd1cd72002
commit b18bab4d7c
4 changed files with 623 additions and 517 deletions

View File

@ -18,17 +18,19 @@ const loadData = async (page: number) => {
</script>
<template>
<Button label="刷新" @click="list.splice(0, list.length) && $refs.infiniteLoading?.refresh()" />
<Card v-for="item in list" :key="item.id" class="mb-[16px]">
<template #title>{{ item.name }}</template>
<template #content>
<p class="text-gray-600">{{ item.email }}</p>
<p class="mt-[8px]">{{ item.body }}</p>
</template>
<template #subtitle>id:{{ item.id }} </template>
<template #footer>{{ item.email }}</template>
</Card>
<div border="1 px solid red">
{{ { 'list.length': list.length } }}
</div>
<UseIntersectionObserverInfiniteLoading :async-load="loadData">
<UseIntersectionObserverInfiniteLoading :async-load="loadData" ref="infiniteLoading">
<!-- <template #error="{ retry }">
<Button fluid @click="retry">Retry</Button>
</template> -->