feat: 添加 UseIntersectionObserverInfiniteLoading 组件的使用示例,优化模板结构 [no-ci]
Some checks failed
/ build-and-deploy-to-vercel (push) Failing after 27s
/ depcheck (push) Successful in 1m24s
/ playwright (push) Successful in 3m38s

This commit is contained in:
严浩
2024-12-11 15:31:03 +08:00
parent 294c73df09
commit 3a9b19d64f
2 changed files with 28 additions and 15 deletions

View File

@ -17,6 +17,19 @@ function checkIsVisible(el: Element, root: Element | null = null) {
</script>
<script setup lang="ts">
/**
* @example
*
* ```ts
* const list = ref<Record<string, never>[]>([]);
* const loadData = async (page: number) => { ... };
* ```
*
* ```vue
* <UseIntersectionObserverInfiniteLoading :async-load="loadData" ref="infiniteLoading" />
* ```
*/
const props = defineProps<{
asyncLoad: (page: number) => Promise<{ hasMore: boolean }>;
}>();