vue 前端分页(el-pagination)展示数据
文章来源 : https://www.cnblogs.com/fengpingfan/p/9811330.html 在web开发过程中,通常使用表格展示数据,在数据较多时采用分页的方式展示给用户。 分页方式有前端假分页和后端分页两种实现方式,此文仅记录前端假分页实现方式。 第一步:添加分页组件(el-pagination)在表格下方,添加的代码如下所示: <template> <el-table> ... </el-table> <el- pagination @size -change="handleSizeChange" @current -change="handleCurrentChange" :current -page="currentPage" :page -sizes="[15, 30, 50, 100]" :page -size="pageSize" layout ="total, sizes, prev, pager, next, jumper" :total ="currentTotal"> </el-pagination> </template> <script> ... </script> 第二步:添加分页所需的变量,如下所示: <script> export default { methods: { ... }, data() { return {