Vue后台管理系统之实现分页功能
2022-08-03 09:57:03
219
{{single.collect_count}}

效果图:

 功能描述:

  1. 显示数据的总数目
  2. 可选择每天的显示条数
  3. 点击页码跳转到指定页数
  4. 输入页码可跳转到指定页

1.功能实现

1.1 结构

<!-- 分页 --><el-pagination@size-change="handleSizeChange"@current-change="handleCurrentChange":current-page="queryInfo.pagenum":page-sizes="[2, 5, 10, 15]":page-size="queryInfo.pagesize"layout="total, sizes, prev, pager, next, jumper":total="total"></el-pagination>

1.2 逻辑

data() {return {//请求参数queryInfo: {type: 3,//当前页数pagenum: 1,//指定当前页数显示的数目pagesize: 5,},goodsList: [],//总数据total: 0,}}methods: {//获取商品分类数据async getGoodsCate() {const { data: res } = await this.$http.get("categories", {params: this.queryInfo,})if (res.meta.status !== 200) {this.$message.error("获取参数失败")}this.total = res.data.totalthis.goodsList = res.data.result//console.log(this.goodsList)},//监听每页的条数handleSizeChange(pagesize) {// console.log(`每页 ${val} 条`)this.queryInfo.pagesize = pagesizethis.getGoodsCate()},//监听当前页数handleCurrentChange(pageNum) {this.queryInfo.pagenum = pageNumthis.getGoodsCate()},},

1.3 参数说明

 

 1.4 效果演示

 

 

 

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}