Skip to content

Commit c019f8f

Browse files
committed
fix(Table): expose $el instead of rootRef
Related to #5230, partial revert of #5162
1 parent 58511e6 commit c019f8f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

docs/app/components/content/examples/table/TableInfiniteScrollExample.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ execute()
6363
const table = useTemplateRef('table')
6464
6565
onMounted(() => {
66-
// `rootRef` has been added in https://github.com/nuxt/ui/pull/5162 and will be available in v4.1.0, use `table.value?.$el` for older versions
67-
useInfiniteScroll(table.value?.rootRef, () => {
66+
useInfiniteScroll(table.value?.$el, () => {
6867
skip.value += 10
6968
}, {
7069
distance: 200,

docs/content/docs/2.components/table.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,6 @@ This will give you access to the following:
677677

678678
| Name | Type |
679679
| ---- | ---- |
680-
| `rootRef`{lang="ts-type"} | `Ref<HTMLDivElement \| null>`{lang="ts-type"} |
681680
| `tableRef`{lang="ts-type"} | `Ref<HTMLTableElement \| null>`{lang="ts-type"} |
682681
| `tableApi`{lang="ts-type"} | [`Ref<Table \| null>`{lang="ts-type"}](https://tanstack.com/table/latest/docs/api/core/table#table-api) |
683682

src/runtime/components/Table.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ const groupingState = defineModel<GroupingState>('grouping', { default: [] })
322322
const expandedState = defineModel<ExpandedState>('expanded', { default: {} })
323323
const paginationState = defineModel<PaginationState>('pagination', { default: {} })
324324
325-
const rootRef = ref()
325+
const rootRef = ref<InstanceType<typeof Primitive>>()
326326
const tableRef = ref<HTMLTableElement | null>(null)
327327
328328
const tableApi = useVueTable({
@@ -473,7 +473,9 @@ watch(() => props.data, () => {
473473
}, props.watchOptions)
474474
475475
defineExpose({
476-
rootRef,
476+
get $el() {
477+
return rootRef.value?.$el
478+
},
477479
tableRef,
478480
tableApi
479481
})

0 commit comments

Comments
 (0)