Skip to content

Commit

Permalink
Merge pull request #935 from 3YOURMIND/fix-off-by-one-in-kt-pagination
Browse files Browse the repository at this point in the history
fix(KtPagination): don't increment  as v-for starts iteration at 1
  • Loading branch information
Isokaeder authored Jun 6, 2024
2 parents 4316184 + a8c2b7d commit 0776a0b
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<div class="inline-container">
<li
v-for="(page, index) in pageAmount"
:key="index"
:class="paginatorClasses(page, 'page-item--active')"
@click="$emit('setPage', page)"
v-text="getHumanReadablePageNumber(page)"
v-for="page in pageAmount"
:key="page"
:class="paginatorClasses(page - 1, 'page-item--active')"
@click="$emit('setPage', page - 1)"
v-text="page"
/>
</div>
</template>
Expand All @@ -23,7 +23,6 @@ export default defineComponent({
emits: ['setPage'],
setup(props) {
return {
getHumanReadablePageNumber: (pageNumber: number) => pageNumber + 1,
pageAmount: computed(() => Math.ceil(props.total / props.pageSize)),
paginatorClasses: (pageNumber: number, className: string) => ({
'page-item': true,
Expand Down

0 comments on commit 0776a0b

Please sign in to comment.