feat(Pagination): new component (#257)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
Co-authored-by: Haytham A. Salama <haythamasalama@gmail.com>
This commit is contained in:
Sylvain Marroufin
2023-06-09 18:12:40 +02:00
committed by GitHub
parent f7a34c8fee
commit f0b24ba25d
11 changed files with 625 additions and 13 deletions

View File

@@ -366,6 +366,41 @@ const filteredRows = computed(() => {
```
::
### Paginable
You can easily use the [Pagination](/navigation/pagination) component to paginate the rows.
::component-example
---
padding: false
---
#default
:table-example-paginable{class="w-full"}
#code
```vue
<script setup>
const people = [...]
const page = ref(1)
const pageCount = 5
const rows = computed(() => {
return people.slice((page.value - 1) * pageCount, (page.value) * pageCount)
})
</script>
<template>
<div>
<UTable :rows="rows" />
<UPagination v-model="page" :page-count="pageCount" :total="people.length" />
</div>
</template>
```
::
### Empty
Use the `empty-state` prop to display a message when there are no results.