diff --git a/playground/pages/pagination.vue b/playground/pages/pagination.vue index 940d9f2f..180cb610 100644 --- a/playground/pages/pagination.vue +++ b/playground/pages/pagination.vue @@ -3,5 +3,15 @@ const page = ref(5) diff --git a/src/runtime/components/Pagination.vue b/src/runtime/components/Pagination.vue index 4608b7f1..a15da4ed 100644 --- a/src/runtime/components/Pagination.vue +++ b/src/runtime/components/Pagination.vue @@ -2,6 +2,7 @@ import { tv } from 'tailwind-variants' import type { PaginationRootProps, PaginationRootEmits } from 'radix-vue' import type { AppConfig } from '@nuxt/schema' +import type { RouteLocationRaw } from '#vue-router' import _appConfig from '#build/app.config' import theme from '#build/ui/pagination' import type { ButtonProps } from '#ui/types' @@ -23,6 +24,7 @@ export interface PaginationProps extends Omit { showControls?: boolean size?: ButtonProps['size'] class?: any + to?: (page: number) => RouteLocationRaw ui?: Partial } @@ -76,12 +78,12 @@ const ui = computed(() => tv({ extend: pagination, slots: props.ui })()) - + - + @@ -94,6 +96,7 @@ const ui = computed(() => tv({ extend: pagination, slots: props.ui })()) :size="size" :label="String(item.value)" :ui="{ label: ui.label() }" + :to="to?.(item.value)" square /> @@ -108,12 +111,12 @@ const ui = computed(() => tv({ extend: pagination, slots: props.ui })()) - + - +