• ElementUi中eltable分页效果,前端控制分页


    现实的场景中很经常遇到表格el-table数据过多,为了更好的用户体验,所以我们需要用到分页,一般分页可以视数据量的大小可分为前端控制和后端控制。

    <template>
    <el-table
    :data="tableData.slice((currentPage-1)*pagesize,currentPage*pagesize)"
    :stripe="stripe"
    :current-page.sync="currentPage"
    style=" 100%">
    <el-table-column
    prop="date"
    label="日期"
    width="180">
    </el-table-column>
    <el-table-column
    prop="name"
    label="姓名"
    width="180">
    </el-table-column>
    <el-table-column
    prop="address"
    label="地址">
    </el-table-column>
    </el-table>
    <div class="pagination">
    <el-pagination
    @size-change="handleSizeChange"
    @current-change="handleCurrentChange"
    :page-sizes="[10, 15, 20]"
    :page-size="pagesize"
    layout="total, sizes, prev, pager, next, jumper"
    :total="total">
    </el-pagination>
    </template>
    <script>
    export default {
    data(){
    return{
    stripe:true,//是否为斑马纹 table
    tableData: [],
    currentPage:1,
    pagesize:10,
    total:0,
    }
    },
    methods:{
    handleSizeChange(val) {
    this.pagesize=val;
    },
    handleCurrentChange(val) {
    this.currentPage = val;
    },
    }
    }
    <script>
    ————————————————
    版权声明:本文为CSDN博主「前端菜鸟一枚」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/qq_40599116/article/details/121951820

  • 相关阅读:
    office 2013激活
    MVC interview question
    javaScript true /false
    17 ways to Optimize VBA Code for FASTER Macros
    50 Excel VBA Oral Interview Questions
    How to compare two worksheets in a workoo
    Access窗体传值
    How to Convert a workbook/WorkSheet to PDF
    01_js数据类型
    02_js两个变量交换值
  • 原文地址:https://www.cnblogs.com/javalinux/p/16293033.html
Copyright © 2020-2023  润新知