vue根据表格分页,前端实现方法

html:

      <el-table
        :data="tableData.slice((curPage-1)*pagesize,curPage*pagesize)"
        border
        style="width: 100%">
        <el-table-column
          label="订单编号"
          min-width="150">
          <template slot-scope="scope">
            <span>{{ scope.row.date }}</span>
          </template>
        </el-table-column>
      </el-table>


          <el-pagination
            :current-page.sync="curPage"
            :page-size="pagesize"
            :pager-count="7"
            :total="tableData.length"
            background
            layout="total, prev, pager, next, jumper">
          </el-pagination>

js:

data() {
    return {
      pagesize: 15,
      curPage: 1,
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        }
      ]
    };
  },

完成

猜你喜欢

转载自blog.csdn.net/bamboozjy/article/details/83625040
今日推荐