diff --git a/components/Table.vue b/components/Table.vue index 1cba4a24d..7b07abb5e 100644 --- a/components/Table.vue +++ b/components/Table.vue @@ -42,14 +42,21 @@ const pagesRange = computed((): VPage[] => { return vPages; }); +const navigateToPage = (to: number) => { + page.value = to; + focus(); +}; + const section = useTemplateRef('section'); +const focus = () => { + section.value?.scrollIntoView(); +}; + defineExpose({ reset() { - page.value = 0; - }, - focus() { - section.value?.scrollIntoView(); + navigateToPage(0); }, + focus, }); @@ -63,9 +70,9 @@ defineExpose({ :key="p.text" :class="['page-item', p.page === page ? 'active' : '', p.enabled ? '' : 'disabled']" > - + {{ p.text }} @@ -108,9 +115,9 @@ defineExpose({ :key="p.text" :class="['page-item', p.page === page ? 'active' : '', p.enabled ? '' : 'disabled']" > - + {{ p.text }}