分页容器 ProPagination
集成分页组件的布局容器
自动分页模式
根据传入数据源,进行本地分页
vue
<script lang="ts" setup>
import { ProPagination } from '@vrx-arco/pro-components'
import { Card, List, ListItem } from '@arco-design/web-vue'
</script>
<template>
<Card>
<ProPagination
style="height: 500px"
pagination
:data="
Array(30)
.fill(1)
.map((_, index) => index + 1)
"
>
<template #default="list">
<List :data="list">
<template #item="{ item }">
<ListItem>{{ item }}</ListItem>
</template>
</List>
</template>
</ProPagination>
</Card>
</template>
受控分页模式
vue
<script lang="ts" setup>
import { ProPagination } from '@vrx-arco/pro-components'
import { Card, List, ListItem } from '@arco-design/web-vue'
import { usePaginatedData } from '@vrx/core'
const { pagination, pageChange, pageSizeChange, list } = usePaginatedData(
({ pagination }) =>
Promise.resolve({
data: Array(20)
.fill(1)
.map((_, index) => pagination.pageNum * (index + 1)),
total: 20,
}),
{ immediate: true, initData: () => [], path: 'data', totalPath: 'total' }
)
</script>
<template>
<Card>
<ProPagination
style="height: 500px"
:pagination="pagination"
:data="list"
@currentChange="pageChange"
@pageSizeChange="pageSizeChange"
>
<template #default="list">
<List :data="list">
<template #item="{ item }">
<ListItem>{{ item }}</ListItem>
</template>
</List>
</template>
</ProPagination>
</Card>
</template>
API
<pro-pagination>
Props
<pro-pagination>
Events
<pro-pagination>
Slots