mirror of https://github.com/wg-easy/wg-easy
7 changed files with 93 additions and 37 deletions
@ -1,32 +1,61 @@ |
|||||
<template> |
<template> |
||||
<div |
<PaginationRoot |
||||
class="mt-4 flex items-center justify-center gap-2" |
:total="clientsStore.total" |
||||
|
:page="clientsStore.page" |
||||
|
:itemsPerPage="clientsStore.limit" |
||||
|
:sibling-count="1" |
||||
|
show-edges |
||||
|
@update:page="setPage" |
||||
> |
> |
||||
<button |
<PaginationList |
||||
class="btn" |
v-slot="{ items }" |
||||
v-if="clientsStore.page > 1" |
class="mt-4 mb-2 flex items-center gap-1 justify-center" |
||||
@click="setPage(clientsStore.page - 1)" |
|
||||
> |
> |
||||
← |
<PaginationFirst class="inline-flex items-center text-gray-700 dark:text-neutral-200"> |
||||
</button> |
<IconsChevronDoubleLeft class="w-4 md:mr-2" /> |
||||
|
</PaginationFirst> |
||||
<span class="text-sm text-gray-500"> |
<PaginationPrev class="inline-flex items-center text-gray-700 dark:text-neutral-200"> |
||||
{{ clientsStore.page }} / {{ clientsStore.totalPages }} |
<IconsChevronLeft class="w-4 md:mr-2" /> |
||||
</span> |
</PaginationPrev> |
||||
|
<template v-for="(page, index) in items"> |
||||
<button |
<PaginationListItem |
||||
class="btn" |
v-if="page.type === 'page'" |
||||
v-if="clientsStore.page < clientsStore.totalPages" |
:key="index" |
||||
@click="setPage(clientsStore.page + 1)" |
class="inline-flex items-center rounded border-2 border-gray-100 px-4 py-2 text-gray-700 transition hover:border-red-800 hover:bg-red-800 hover:text-white dark:border-neutral-600 dark:text-neutral-200 data-[selected]:border-red-800 data-[selected]:bg-red-800 data-[selected]:text-white" |
||||
|
:value="page.value" |
||||
|
> |
||||
|
{{ page.value }} |
||||
|
</PaginationListItem> |
||||
|
<PaginationEllipsis |
||||
|
v-else |
||||
|
:key="page.type" |
||||
|
:index="index" |
||||
|
class="w-9 h-9 flex items-center justify-center text-gray-700 dark:text-neutral-200" |
||||
> |
> |
||||
→ |
… |
||||
</button> |
</PaginationEllipsis> |
||||
</div> |
</template> |
||||
|
<PaginationNext class="inline-flex items-center text-gray-700 dark:text-neutral-200"> |
||||
|
<IconsChevronRight class="w-4 md:mr-2" /> |
||||
|
</PaginationNext> |
||||
|
<PaginationLast class="inline-flex items-center text-gray-700 dark:text-neutral-200"> |
||||
|
<IconsChevronDoubleRight class="w-4 md:mr-2" /> |
||||
|
</PaginationLast> |
||||
|
</PaginationList> |
||||
|
</PaginationRoot> |
||||
</template> |
</template> |
||||
|
|
||||
<script setup lang="ts"> |
<script setup lang="ts"> |
||||
|
import { |
||||
|
PaginationEllipsis, |
||||
|
PaginationFirst, |
||||
|
PaginationLast, |
||||
|
PaginationList, |
||||
|
PaginationListItem, |
||||
|
PaginationNext, |
||||
|
PaginationPrev, |
||||
|
PaginationRoot } from 'radix-vue' |
||||
const clientsStore = useClientsStore(); |
const clientsStore = useClientsStore(); |
||||
|
|
||||
function setPage(p: number) { |
function setPage(p: number) { |
||||
clientsStore.setPageQuery(p); |
clientsStore.setPageQuery(p); |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,7 @@ |
|||||
|
<template> |
||||
|
<ChevronDoubleLeftIcon /> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
import ChevronDoubleLeftIcon from '@heroicons/vue/24/outline/esm/ChevronDoubleLeftIcon'; |
||||
|
</script> |
||||
@ -0,0 +1,7 @@ |
|||||
|
<template> |
||||
|
<ChevronDoubleRightIcon /> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
import ChevronDoubleRightIcon from '@heroicons/vue/24/outline/esm/ChevronDoubleRightIcon'; |
||||
|
</script> |
||||
@ -0,0 +1,7 @@ |
|||||
|
<template> |
||||
|
<ChevronLeftIcon /> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
import ChevronLeftIcon from '@heroicons/vue/24/outline/esm/ChevronLeftIcon'; |
||||
|
</script> |
||||
@ -0,0 +1,7 @@ |
|||||
|
<template> |
||||
|
<ChevronRightIcon /> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
import ChevronRightIcon from '@heroicons/vue/24/outline/esm/ChevronRightIcon'; |
||||
|
</script> |
||||
Loading…
Reference in new issue