-
Notifications
You must be signed in to change notification settings - Fork 988
Closed
Labels
Description
Context
I'm working with @nuxt/[email protected] and I encountered an issue
In the official documentation
When implementing infinite scroll pagination, the documentation provides this example:
const table = useTemplateRef('table')
onMounted(() => {
useInfiniteScroll(
table.value?.rootRef,
() => {
skip.value += 10
},
{
distance: 200,
canLoadMore: () => {
return status.value !== 'pending'
}
}
)
})However, the table reference (table) only exposes:
tableRef: Ref<HTMLTableElement | null, HTMLTableElement | null>;
tableApi: Table<Scrap>;The rootRef property does not exist.
The solution
Use parentElement from tableRef
onMounted(() => {
useInfiniteScroll(
table.value?.tableRef?.parentElement,
() => {
emit('fetchNextPage');
},
{
distance: 200,
canLoadMore: () => !loading,
}
);
});My question
Is the documentation outdated?