Skip to content

Commit 9773320

Browse files
committed
fix(pagination): next button still enable when total page 0
1 parent ec824e2 commit 9773320

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/components/pagination/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { computed, toRef } from 'vue-demi'
22
import {
3-
getPageItems, getPageRange, PAGE_PADDING,
3+
getPageItems,
4+
getPageRange,
5+
PAGE_PADDING,
46
} from './utils/calculate-page'
57

68
interface PaginationProps {
@@ -40,8 +42,8 @@ export function usePagination (props: PaginationProps) {
4042
return getPageItems(page.value, totalPageCount.value, displayLimit.value)
4143
})
4244

43-
const canNext = computed(() => page.value !== totalPageCount.value)
44-
const canPrev = computed(() => page.value !== 1)
45+
const canNext = computed(() => page.value < totalPageCount.value)
46+
const canPrev = computed(() => page.value > 1)
4547

4648
return {
4749
pageItems,

0 commit comments

Comments
 (0)