fix prefix

git 2025-12-13 15:04:20 +08:00
parent ee8663a423
commit 0db3b850e7
Signed by: git
GPG Key ID: 3F65EFFA44207ADD
2 changed files with 4 additions and 4 deletions

View File

@ -137,7 +137,7 @@ func (p *Paginator[T]) LastPage() int {
// PreviewPage 上一页, 如果为0, 表示不显示
func (p *Paginator[T]) PreviewPage() int {
preview := p.curPage - 1
if preview <= 1 {
if preview < 1 {
preview = 0
}
@ -147,7 +147,7 @@ func (p *Paginator[T]) PreviewPage() int {
// PreviewPage 下一页, 如果为0, 表示不显示
func (p *Paginator[T]) NextPage() int {
next := p.curPage + 1
if next >= p.TotalPage() {
if next > p.TotalPage() {
next = 0
}

View File

@ -6,9 +6,9 @@ import (
func TestCut(t *testing.T) {
items := []int{1, 2, 3}
page := 1
page := 2
limit := 1
pageCount := 3
pageCount := 1
pag := Cut(items, page, limit, pageCount)
t.Logf("pag: %s", pag)
}