Zlpt_Portal/src/components/PagingComponent/index.vue

49 lines
1.2 KiB
Vue
Raw Normal View History

2023-12-04 09:12:38 +08:00
<script setup lang="ts">
const emit = defineEmits(['getList'])
// 每页数量值改变
const handleSizeChange = (val: Number) => {
// 传递每页数量
emit('getList', val)
}
// 页码值改变
const handleCurrentChange = (val: Number) => {
// 传递页码值
emit('getList', val)
}
defineProps<Props>()
interface Props {
pageSize?: 20
pageNumber?: 1
total?: 0
}
// const handleTotalText = () => {
// const targetDom: any = document.querySelector('.el-pagination__total')
// targetDom.innerText = `数量${total.value}`
// }
// onMounted(() => {
// // handleTotalText()
// })
</script>
2023-12-02 18:05:58 +08:00
<template>
<!-- 分页 -->
2023-12-02 18:10:19 +08:00
<el-pagination
2023-12-04 09:12:38 +08:00
:current-page="pageNumber"
:page-size="pageSize"
:page-sizes="[10, 20, 30, 40]"
2023-12-02 18:10:19 +08:00
small="small"
background="background"
layout="total, sizes, prev, pager, next, jumper"
2023-12-04 09:12:38 +08:00
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange" />
2023-12-02 18:05:58 +08:00
</template>
<style>
2023-12-02 18:10:19 +08:00
.el-pagination {
margin-top: 15px;
}
2023-12-02 18:05:58 +08:00
</style>