pagination

package
v2.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PageItem

type PageItem struct {
	Type     string // "page", "prev", "next", "ellipsis"
	Page     int    // 页码(仅对Type="page"有效)
	Disabled bool   // 是否禁用
}

PageItem 分页项类型

type Pagination

type Pagination struct {
	TotalItems     int // 总记录数
	CurrentPage    int // 当前页码
	PageSize       int // 每页记录数
	MaxPagesToShow int // 最大显示的页码数量(包括折叠按钮)
}

Pagination 分页结构体

func New

func New(totalItems, currentPage, pageSize, maxPagesToShow int) *Pagination

New 创建分页实例

func (*Pagination) GetPages

func (p *Pagination) GetPages() []PageItem

GetPages 获取要显示的分页项

func (*Pagination) HasNext

func (p *Pagination) HasNext() bool

HasNext 是否有下一页

func (*Pagination) HasPrev

func (p *Pagination) HasPrev() bool

HasPrev 是否有上一页

func (*Pagination) NextPage

func (p *Pagination) NextPage() int

NextPage 下一页页码

func (*Pagination) PrevPage

func (p *Pagination) PrevPage() int

PrevPage 上一页页码

func (*Pagination) TotalPages

func (p *Pagination) TotalPages() int

TotalPages 计算总页数

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL