/*! For license information please see 902.61d9d82d.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["902"],{67206:function(t,n,s){"use strict";s.r(n);var a=s("80681");let e=["innerHTML"];n.default={setup:()=>({html:""}),render:()=>((0,a.wg)(),(0,a.iD)("div",{class:"van-doc-markdown-body",innerHTML:'
When the amount of data is too much, use pagination to separate the data, and load only one page at a time.
\nRegister component globally via app.use
, refer to Component Registration for more registration ways.
import { createApp } from 'vue';\nimport { Pagination } from 'vant';\n\nconst app = createApp();\napp.use(Pagination);\n
\n<van-pagination v-model="currentPage" :total-items="24" :items-per-page="5" />\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const currentPage = ref(1);\n return { currentPage };\n },\n};\n
\n<van-pagination v-model="currentPage" :page-count="12" mode="simple" />\n
\n<van-pagination\n v-model="currentPage"\n :total-items="125"\n :show-page-size="3"\n force-ellipses\n/>\n
\n<van-pagination v-model="currentPage" :total-items="50" :show-page-size="5">\n <template #prev-text>\n <van-icon name="arrow-left" />\n </template>\n <template #next-text>\n <van-icon name="arrow" />\n </template>\n <template #page="{ text }">{{ text }}</template>\n</van-pagination>\n
\nAttribute | \nDescription | \nType | \nDefault | \n
---|---|---|---|
v-model | \nCurrent page number | \nnumber | \n- | \n
mode | \nMode, can be set to simple multi | \nstring | \nmulti | \n
prev-text | \nPrevious text | \nstring | \nPrevious | \n
next-text | \nNext text | \nstring | \nNext | \n
total-items | \nTotal items | \nnumber | string | \n0 | \n
items-per-page | \nItem number per page | \nnumber | string | \n10 | \n
page-count | \nThe total number of pages, if not set, will be calculated based on total-items and items-per-page | \nnumber | string | \n- | \n
show-page-size | \nCount of page size to show | \nnumber | string | \n5 | \n
force-ellipses | \nWhether to show ellipses | \nboolean | \nfalse | \n
show-prev-button v4.2.1 | \nWhether to show prev button | \nboolean | \ntrue | \n
show-next-button v4.2.1 | \nWhether to show next button | \nboolean | \ntrue | \n
Event | \nDescription | \nArguments | \n
---|---|---|
change | \nEmitted when current page changed | \n- | \n
Name | \nDescription | \nSlotProps | \n
---|---|---|
page | \nCustom pagination item | \n{ number: number, text: string, active: boolean } | \n
prev-text | \nCustom prev text | \n- | \n
next-text | \nCustom next text | \n- | \n
The component exports the following type definitions:
\nimport type { PaginationMode, PaginationProps } from 'vant';\n
\nThe component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.
\nName | \nDefault Value | \nDescription | \n
---|---|---|
--van-pagination-height | \n40px | \n- | \n
--van-pagination-font-size | \nvar(--van-font-size-md) | \n- | \n
--van-pagination-item-width | \n36px | \n- | \n
--van-pagination-item-default-color | \nvar(--van-primary-color) | \n- | \n
--van-pagination-item-disabled-color | \nvar(--van-gray-7) | \n- | \n
--van-pagination-item-disabled-background | \nvar(--van-background) | \n- | \n
--van-pagination-background | \nvar(--van-background-2) | \n- | \n
--van-pagination-desc-color | \nvar(--van-gray-7) | \n- | \n
--van-pagination-disabled-opacity | \nvar(--van-disabled-opacity) | \n- | \n