html代码:
<section class="container page-home"> <div id="main-content" class="wrap-container zerogrid"> <article id="news_content" v-for="item in items"> <div class="col-1-2 right"> <img :src="/UploadFiles/2021-04-02/item.coverimage">js:
/查询相关新闻种类下的所有新闻记录 var vm = new Vue({ el: '.page-home', //需要注入的模板的父元素 data: { items : [], pages : [], currentPage : [] }, //end data created:function(){ $.post("/island/stage/queryOneCategoryAllNews.do",{"categoryid":parseInt(categoryid),"currentPage":1},function(data){ vm.pages = data.totalPage; //总页码 vm.items = data.list; //循环内容 vm.currentPage = data.currentPage; //当前页(添加高亮样式) }); //end post }, //created methods:{ clickpage:function(event){ var currentPage = $(event.currentTarget).text(); $.post("/island/stage/queryOneCategoryAllNews.do",{"categoryid":parseInt(categoryid),"currentPage":parseInt(currentPage)},function(data){ vm.items = data.list; //循环内容 vm.pages = data.totalPage; //总页码 vm.currentPage = data.currentPage; //当前页(添加高亮样式) }); //end post } //end method } }); //end vuejava后台:
package com.zrq.util; import java.util.List; import org.springframework.stereotype.Component; @Component public class PageUtil { /* * // 默认的每页记录数量(10条) private static final int DEFAULT_PAGE_SIZE = 10; // * 默认当前页 private static final int DEFAULT_CURRENT_PAGE = 1; */ // 1.每页显示数量(everyPage) private int everyPage; // 2.总记录数(totalCount) private long totalCount; // 3.总页数 private long totalPage; // 4.当前页(currentPage) private int currentPage; // 5.起始下标(beginIndex) private int beginIndex; // 6.判断是否有上一页 private boolean next; // 7.判断是否有下一页 private boolean previous; // 8.返回列表 private List list; /* 获取总页数 */ public long getTotalPage() { long remainder = totalCount % this.getEveryPage(); // 剩余数 if (remainder == 0) totalPage = totalCount / this.getEveryPage(); else totalPage = totalCount / this.getEveryPage() + 1; return totalPage; } /* 判断是否有上一页 */ public void hasPrevious() { if (currentPage > 1) this.setPrevious(true); else this.setPrevious(false); } /* 判断是否有下一页 */ public void hasNext() { if (currentPage < this.getTotalCount()) this.setNext(true); else this.setNext(false); } public boolean isNext() { return next; } public boolean isPrevious() { return previous; } public void setTotalPage(long totalPage) { this.totalPage = totalPage; } public void setNext(boolean next) { this.next = next; } public void setPrevious(boolean previous) { this.previous = previous; } public int getEveryPage() { return everyPage; } public long getTotalCount() { return totalCount; } public int getCurrentPage() { return currentPage; } public int getBeginIndex() { return beginIndex; } public List getList() { return list; } public void setEveryPage(int everyPage) { this.everyPage = everyPage; } public void setTotalCount(long totalCount) { this.totalCount = totalCount; } public void setCurrentPage(int currentPage) { this.currentPage = currentPage; } public void setBeginIndex(int beginIndex) { this.beginIndex = beginIndex; } public void setList(List list) { this.list = list; } public PageUtil(int currentPage, int pageSize) { this.currentPage = currentPage; this.everyPage = pageSize; } public PageUtil() { /* * this.currentPage = DEFAULT_CURRENT_PAGE; this.everyPage = * DEFAULT_PAGE_SIZE; */ } public PageUtil(int everyPage, int totalCount, int currentPage, int beginIndex, List list) { super(); this.everyPage = everyPage; this.totalCount = totalCount; this.currentPage = currentPage; this.beginIndex = beginIndex; this.list = list; } }以上这篇vue.js分页中单击页码更换页面内容的方法(配合spring springmvc)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
暂无“vue.js分页中单击页码更换页面内容的方法(配合spring springmvc)”评论...
更新动态
2024年11月15日
2024年11月15日
- 黄乙玲1988-无稳定的爱心肝乱糟糟[日本东芝1M版][WAV+CUE]
- 群星《我们的歌第六季 第3期》[320K/MP3][70.68MB]
- 群星《我们的歌第六季 第3期》[FLAC/分轨][369.48MB]
- 群星《燃!沙排少女 影视原声带》[320K/MP3][175.61MB]
- 乱斗海盗瞎6胜卡组推荐一览 深暗领域乱斗海盗瞎卡组分享
- 炉石传说乱斗6胜卡组分享一览 深暗领域乱斗6胜卡组代码推荐
- 炉石传说乱斗本周卡组合集 乱斗模式卡组最新推荐
- 佟妍.2015-七窍玲珑心【万马旦】【WAV+CUE】
- 叶振棠陈晓慧.1986-龙的心·俘虏你(2006复黑限量版)【永恒】【WAV+CUE】
- 陈慧琳.1998-爱我不爱(国)【福茂】【WAV+CUE】
- 咪咕快游豪礼放送,百元京东卡、海量欢乐豆就在咪咕咪粉节!
- 双11百吋大屏焕新“热”,海信AI画质电视成最大赢家
- 海信电视E8N Ultra:真正的百吋,不止是大!
- 曾庆瑜1990-曾庆瑜历年精选[派森][WAV+CUE]
- 叶玉卿1999-深情之选[飞图][WAV+CUE]