表格分页处理

This commit is contained in:
gary.fu
2024-01-03 18:21:40 +08:00
parent 75a5d784ac
commit 8c76462093
5 changed files with 79 additions and 43 deletions

View File

@@ -60,14 +60,17 @@ const props = defineProps({
type: Object,
default: null
},
pageInfo: {
page: {
type: Object,
default: null
},
pageAttrs: {
type: Object,
default () {
return {}
return {
layout: 'total, sizes, prev, pager, next',
pageSizes: [10, 20, 50]
}
}
}
})
@@ -89,6 +92,9 @@ const calcColumns = computed(() => {
}
return _columns
})
defineEmits(['pageSizeChange', 'currentPageChange'])
</script>
<template>
@@ -118,10 +124,21 @@ const calcColumns = computed(() => {
/>
</template>
</common-table-column>
<el-pagination v-if="pageInfo" />
</el-table>
<el-pagination
v-if="page && page.totalCount"
class="common-pagination"
v-bind="pageAttrs"
:total="page.totalCount"
:page-size="page.pageSize"
:current-page="page.pageIndex"
@size-change="$emit('pageSizeChange', $event)"
@current-change="$emit('currentPageChange', $event)"
/>
</template>
<style scoped>
.common-pagination {
margin-top: 15px;
}
</style>