mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-08-03 02:56:45 -04:00
(nouns) scroll to top of <Table> when page navigation is used
This commit is contained in:
parent
f739275809
commit
52e8147e84
@ -42,14 +42,21 @@ const pagesRange = computed((): VPage[] => {
|
||||
return vPages;
|
||||
});
|
||||
|
||||
const navigateToPage = (to: number) => {
|
||||
page.value = to;
|
||||
focus();
|
||||
};
|
||||
|
||||
const section = useTemplateRef<HTMLElement>('section');
|
||||
const focus = () => {
|
||||
section.value?.scrollIntoView();
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
reset() {
|
||||
page.value = 0;
|
||||
},
|
||||
focus() {
|
||||
section.value?.scrollIntoView();
|
||||
navigateToPage(0);
|
||||
},
|
||||
focus,
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -63,9 +70,9 @@ defineExpose({
|
||||
:key="p.text"
|
||||
:class="['page-item', p.page === page ? 'active' : '', p.enabled ? '' : 'disabled']"
|
||||
>
|
||||
<a v-if="p.enabled" class="page-link" href="#" @click.prevent="page = p.page">
|
||||
<button v-if="p.enabled" type="button" class="page-link" @click="navigateToPage(p.page)">
|
||||
{{ p.text }}
|
||||
</a>
|
||||
</button>
|
||||
<span v-else class="page-link">
|
||||
{{ p.text }}
|
||||
</span>
|
||||
@ -108,9 +115,9 @@ defineExpose({
|
||||
:key="p.text"
|
||||
:class="['page-item', p.page === page ? 'active' : '', p.enabled ? '' : 'disabled']"
|
||||
>
|
||||
<a v-if="p.enabled" class="page-link" href="#" @click.prevent="page = p.page">
|
||||
<button v-if="p.enabled" type="button" class="page-link" @click="navigateToPage(p.page)">
|
||||
{{ p.text }}
|
||||
</a>
|
||||
</button>
|
||||
<span v-else class="page-link">
|
||||
{{ p.text }}
|
||||
</span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user