Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | 16x 5x 6x 36x 36x 2x 6x 16x 16x 16x 16x 6x | <template>
<div v-if="pageCount > 1" class="relative border-t border-default">
<p
class="pointer-events-none absolute inset-x-0 top-0 flex h-12 items-center justify-center font-sans text-meta text-muted tabular-nums sm:hidden"
>
{{ $t("pagination.position", { page, total: pageCount }) }}
</p>
<UPagination
:page
:total
:items-per-page="perPage"
:sibling-count="1"
:show-controls="false"
:aria-label="$t('pagination.label')"
show-edges
>
<template #prev>
<UButton
variant="link"
icon="i-lucide-arrow-left"
:label="$t('pagination.previous.text')"
:aria-label="$t('pagination.previous.label')"
:to="previousLink"
:disabled="!previousLink"
class="-ml-3 min-h-12"
/>
</template>
<template #item="{ item }">
<ULink
v-if="item.type === 'page'"
raw
:to="to(item.value)"
:aria-label="$t('pagination.page', { page: item.value })"
:aria-current="item.value === page ? 'page' : undefined"
class="relative inline-flex min-h-12 min-w-11 items-center justify-center font-sans text-sm font-semibold text-muted tabular-nums transition-colors before:absolute before:inset-x-1.5 before:-top-px before:h-0.5 before:transition-colors hover:text-highlighted hover:before:bg-ivory-400 focus-visible:rounded-xs aria-[current=page]:text-highlighted aria-[current=page]:before:bg-inverted max-sm:hidden"
>
{{ item.value }}
</ULink>
</template>
<template #ellipsis>
<span
class="inline-flex min-h-12 min-w-8 items-center justify-center font-sans text-sm text-dimmed"
>…</span
>
</template>
<template #next>
<UButton
variant="link"
trailing-icon="i-lucide-arrow-right"
:label="$t('pagination.next.text')"
:aria-label="$t('pagination.next.label')"
:to="nextLink"
:disabled="!nextLink"
class="-mr-3 min-h-12"
/>
</template>
</UPagination>
</div>
</template>
<script setup lang="ts">
import type { RouteLocationRaw } from "vue-router";
interface Props {
page: number;
total: number;
perPage: number;
to: (page: number) => RouteLocationRaw;
}
const props = defineProps<Props>();
const pageCount = computed<number>(() => Math.max(1, Math.ceil(props.total / props.perPage)));
const previousLink = computed(() => (props.page > 1 ? props.to(props.page - 1) : undefined));
const nextLink = computed(() =>
props.page < pageCount.value ? props.to(props.page + 1) : undefined,
);
</script>
|