This commit is contained in:
Damien Broqua 2022-02-22 08:38:37 +01:00
parent 7cc43dba43
commit 6f47666205

View file

@ -73,9 +73,23 @@
<a class="pagination-previous" :class="{'is-disabled': page === 1}" @click="previous">Précédent</a>
<a class="pagination-next" :class="{'is-disabled': !total || (page*limit) >= total}" @click="next">Suivant</a>
<ul class="pagination-list">
<li v-for="p in Array.from({length: totalPages}, (v, i) => (i+1))">
<a class="pagination-link" :class="{'is-current': p === page}" @click="goTo(p)" aria-label="Goto page 1">{{ p }}</a>
<template v-for="p in Array.from({length: totalPages}, (v, i) => (i+1))">
<template v-if="page >= 8 && p === 4">
<li>
<a class="pagination-link is-disabled">…</a>
</li>
</template>
<template v-if="p <= 3 || p > (totalPages - 3) || (p >= (page - 3) && p <= (page + 3))">
<li>
<a class="pagination-link" :class="{'is-current': p === page}" @click="goTo(p)" aria-label="Aller à la page {{p}}">{{ p }}</a>
</li>
</template>
<template v-if="page >= 8 && p === totalPages - 4 && page <= totalPages - 7">
<li>
<a class="pagination-link is-disabled">…</a>
</li>
</template>
</template>
</ul>
</nav>