外观
Pagination 分页
根据总条数和每页数量计算页码,用前后翻页按钮或页码定位结果。
import { SPagination } from '@icecreamqaq/shadcn/pagination'使用示例
常用 API
| 成员 | 类型 | 用法 |
|---|---|---|
SPagination.total | number | 列表的数据总条数。 |
SPagination.itemsPerPage | number | 每页的数据条数,由调用方提供。 |
SPagination.page | number | 支持 v-model:page,页码从 1 开始。 |
SPaginationContent.#default | { items } | 提供页码和省略号,可按 item.type 分别渲染。 |
SPaginationItem.isActive | boolean | 为当前页设置选中样式,一般与绑定的页码比较。 |
分页组件负责页码状态。数据切片或新的网络请求由应用根据当前页处理。
完整 API
Pagination13 个成员
属性
| 名称 | 类型 |
|---|---|
page | number |
defaultPage | number |
itemsPerPage 必填 | number |
total | number |
siblingCount | number |
disabled | boolean |
showEdges | boolean |
clampPage | boolean |
asChild | boolean |
as | AsTag | Component |
class | ClassValue |
事件
| 名称 | 类型 |
|---|---|
update:page | ((value: number) => any) |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: { page: number; pageCount: number; }) => any) |
PaginationContent4 个成员
属性
| 名称 | 类型 |
|---|---|
asChild | boolean |
as | AsTag | Component |
class | ClassValue |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: { items: ({ type: "ellipsis"; } | { type: "page"; value: number; })[]; }) => any) |
PaginationEllipsis4 个成员
属性
| 名称 | 类型 |
|---|---|
asChild | boolean |
as | AsTag | Component |
class | ClassValue |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: {}) => any) |
PaginationFirst5 个成员
属性
| 名称 | 类型 |
|---|---|
asChild | boolean |
as | AsTag | Component |
size | "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null |
class | ClassValue |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: {}) => any) |
PaginationItem7 个成员
属性
| 名称 | 类型 |
|---|---|
value 必填 | number |
asChild | boolean |
as | AsTag | Component |
size | "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null |
class | ClassValue |
isActive | boolean |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: {}) => any) |
PaginationLast5 个成员
属性
| 名称 | 类型 |
|---|---|
asChild | boolean |
as | AsTag | Component |
size | "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null |
class | ClassValue |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: {}) => any) |
PaginationNext5 个成员
属性
| 名称 | 类型 |
|---|---|
asChild | boolean |
as | AsTag | Component |
size | "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null |
class | ClassValue |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: {}) => any) |
PaginationPrevious5 个成员
属性
| 名称 | 类型 |
|---|---|
asChild | boolean |
as | AsTag | Component |
size | "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null |
class | ClassValue |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: {}) => any) |
分组导出
模板标签为 <s-pagination>。
组件 SPagination、SPaginationContent、SPaginationEllipsis、SPaginationFirst、SPaginationItem、SPaginationLast、SPaginationNext、SPaginationPrevious