mirror of https://github.com/wg-easy/wg-easy
7 changed files with 93 additions and 37 deletions
@ -1,33 +1,62 @@ |
|||
<template> |
|||
<div |
|||
class="mt-4 flex items-center justify-center gap-2" |
|||
<PaginationRoot |
|||
:total="clientsStore.total" |
|||
:page="clientsStore.page" |
|||
:itemsPerPage="clientsStore.limit" |
|||
:sibling-count="1" |
|||
show-edges |
|||
@update:page="setPage" |
|||
> |
|||
<button |
|||
class="btn" |
|||
v-if="clientsStore.page > 1" |
|||
@click="setPage(clientsStore.page - 1)" |
|||
<PaginationList |
|||
v-slot="{ items }" |
|||
class="mt-4 mb-2 flex items-center gap-1 justify-center" |
|||
> |
|||
← |
|||
</button> |
|||
|
|||
<span class="text-sm text-gray-500"> |
|||
{{ clientsStore.page }} / {{ clientsStore.totalPages }} |
|||
</span> |
|||
|
|||
<button |
|||
class="btn" |
|||
v-if="clientsStore.page < clientsStore.totalPages" |
|||
@click="setPage(clientsStore.page + 1)" |
|||
> |
|||
→ |
|||
</button> |
|||
</div> |
|||
<PaginationFirst class="inline-flex items-center text-gray-700 dark:text-neutral-200"> |
|||
<IconsChevronDoubleLeft class="w-4 md:mr-2" /> |
|||
</PaginationFirst> |
|||
<PaginationPrev class="inline-flex items-center text-gray-700 dark:text-neutral-200"> |
|||
<IconsChevronLeft class="w-4 md:mr-2" /> |
|||
</PaginationPrev> |
|||
<template v-for="(page, index) in items"> |
|||
<PaginationListItem |
|||
v-if="page.type === 'page'" |
|||
:key="index" |
|||
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" |
|||
> |
|||
… |
|||
</PaginationEllipsis> |
|||
</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> |
|||
|
|||
<script setup lang="ts"> |
|||
const clientsStore = useClientsStore(); |
|||
|
|||
function setPage(p: number) { |
|||
clientsStore.setPageQuery(p); |
|||
import { |
|||
PaginationEllipsis, |
|||
PaginationFirst, |
|||
PaginationLast, |
|||
PaginationList, |
|||
PaginationListItem, |
|||
PaginationNext, |
|||
PaginationPrev, |
|||
PaginationRoot } from 'radix-vue' |
|||
const clientsStore = useClientsStore(); |
|||
function setPage(p: number) { |
|||
clientsStore.setPageQuery(p); |
|||
} |
|||
</script> |
|||
</script> |
|||
@ -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