feat(Pagination): allow using links for pagination buttons (#1682)

This commit is contained in:
Neil Richter
2024-04-18 12:38:48 +02:00
committed by GitHub
parent 3fca66857d
commit 8d9d9736ba
3 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
const page = ref(1)
const items = ref(Array(50))
</script>
<template>
<UPagination
v-model="page"
:page-count="5"
:total="items.length"
:to="(page: number) => ({
query: { page },
// Hash is specified here to prevent the page from scrolling to the top
hash: '#links',
})"
/>
</template>

View File

@@ -46,6 +46,12 @@ props:
---
::
### Links
Use the `to` property to transform buttons into links. Note that it must be a function that receives the page number and returns a route destination.
:component-example{component="pagination-example-to"}
### Disabled
Use the `disabled` prop to disable all the buttons.