<el-pagination background layout="prev, pager, next, jumper" :total="AdminCount" :pager-count="5" :current-page="Page" :page-size="PageSize" @next-click="NextClick" @prev-click="PrevClick" @current-change="CurrentChange"> </el-pagination>
// 上一页
PrevClick(page) {
this.Page = page
},
// 下一页
NextClick(page) {
this.Page = page
},
// 选择数字跳转页数
CurrentChange(page) {
this.Page = page
}
删除 最有一条数据后 返回上一页
//总页数(每次删除计算总页数)AdminCount总数据
const totalPage = Math.ceil((this.AdminCount - 1) / this.PageSize)
//当前页大于总页数代表已经删除最后一条数据 将总页数赋值给当前页 会跳转到上一页
this.Page = this.Page > totalPage ? totalPage : this.Page
// //当页数小于为0 就给它为1页 否则就还是当前页
this.Page = this.Page < 1 ? 1 : this.Page
vue-element分页使用 删除最后一条数据后,返回上一页
最新推荐文章于 2024-04-11 14:13:48 发布