谷粒 | 08 | 前端分页组件

时间:2021-02-15 12:11:29   收藏:0   阅读:0

前端分页: element-UI分页组件

 <!-- 分页 -->
    <el-pagination
      :current-page="page"
      :page-size="size"
      :total="total"
      style="padding: 30px 0; text-align: center;"
      layout="total, prev, pager, next, jumper"
      @current-change="getTeacherList"  //每次分页要重新调用查询方法
    />
 getTeacherList(page = 1){  //设置page默认值为1,es6写法
          this.page = page        //若page有值则覆盖默认值
            teacher.getTeacherListPage(this.page,this.size,this.teacherQuery)
                .then(res => {
                    this.list = res.data.list
                    this.total = res.data.total
                    console.log(this.list)
                    console.log(this.total)
                })
                .catch()
        }
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!