加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

vue.js分页中单击页码更换页面内容的方法(配合spring springmvc)

发布时间:2020-12-15 01:54:12 所属栏目:大数据 来源:网络整理
导读:html代码: {{item.title}} {{item.remark}} div id="pagination" class="clearfix" 1"next js: java后台: import java.util.List; import org.springframework.stereotype.Component; @Component public class PageUtil { /* // 默认的每页记录数量(10条)

html代码:

{{item.title}}

{{item.remark}}

<div id="pagination" class="clearfix">

js:

java后台:

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)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程之家。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读