<div class="block">
<el-pagination
:current-page="currentpage"
@current-change="handleCurrentChange" layout="total, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
pageStudents: [],//分页信息
total: 0, //数据的总行数
currentpage: 1, //当前的所在的页
getStudents: function () {
let _this = this
axios
.get(_this.baseURL + "students/")
.then(function (res) {
if (res.data.code === 1) {
_this.students = res.data.data;
_this.total = res.data.data.length;
_this.getPageStudents();
}
else {
_this.$message.error('获取数据失败');
}
})
.catch(function (err) {
_this.$message.error('通信失败');
})
},
//调整当前的页码
handleCurrentChange(pageNumber) {
//修改当前的页码
this.currentpage = pageNumber;
//数据重新分页
this.getPageStudents();
},
//序号
getIndex(index)
{
console.log(index, this.currentpage)
return index+(this.currentpage-1)*10+1
}
},
12学生信息组件-分页控制
最新推荐文章于 2024-07-22 15:19:55 发布