目录标题
项目场景:
分页也是我们在实际应用当中非常常见的存在,其实分页本身在element中做的就挺好的了,但是使用确实非常的多,所以还是有必要封装一下,主要是为了减少代码的冗余,以及提升开发的效率和降低后续维护的成本。
认识分页
这是一段普通分页的示例
<template>
<div class="block">
<span class="demonstration">完整功能</span>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[100, 200, 300, 400]"
:page-size="100"
layout="total, sizes, prev, pager, next, jumper"
:total="400">
</el-pagination>
</div>
</template>
<script>
export default {
methods: {
handleSizeChange(val) {
console.log(`每页 ${
val} 条`);
},
handleCurrentChange(val) {
console.log(`当前页: ${
val}`);
}
},