fix prefix
parent
ee8663a423
commit
0db3b850e7
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue