vue-admin-template-master 添加分页
1、添加分页组件
<el-pagination :current-page="page" :page-size="limit" :total="total" style="padding: 30px 0; text-align: center;" layout="total, prev, pager, next, jumper" @current-change="getList"/>
2、修改@current-change改变时调用的getList方法
getList(page=1) { //如果page无具体的值则默认赋值1 this.page=page //获取组件page值并进行值传递 teacher .getTeacherListPage(this.page, this.limit, this.teacherQuery) .then((response) => { //請求成功 //response接口返回的数据 this.list = response.data.rows; this.total = response.data.total; }) .catch((error) => { console.log(console.error()); }); },