欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue.js分頁中單擊頁碼更換頁面內(nèi)容的方法(配合spring springmvc)

 更新時間:2018年02月10日 09:44:09   作者:Islandww  
下面小編就為大家分享一篇vue.js分頁中單擊頁碼更換頁面內(nèi)容的方法(配合spring springmvc),具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

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="item.coverimage" class="news_image"/>
<!-- :要與img標簽之間有空格 -->
</div>
<div class="col-1-2 left">
<a class="art-category left" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >{{item.releasetime.substring(0,19)}}</a>
<div class="clear"></div>
<div class="art-content">
<h2>{{item.title}}</h2>
<div class="info">
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >{{item.author}}</a>
</div>
<div class="line"></div>
<p>{{item.remark}}</p>
<a v-bind:href="['/island/stage/newscontent.html?id='+item.id+'&categoryid='+item.categoryid]" rel="external nofollow" class="more">閱讀全文</a>
<span href="javascript:;" rel="external nofollow" class="more" style="margin-left:50px;">瀏覽量 : {{item.reading}}</span>
</div>
</div>
</article>
<!-- 循環(huán)結(jié)束(新聞) -->
</div>

<div id="pagination" class="clearfix">
<ul>
<li v-for="page in pages">
<a class="current" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" v-if="currentPage == page">{{page}}</a>
<!-- 高亮顯示當前頁 -->
<a class="choose_page" v-if="currentPage != page" @click="clickpage">{{page}}</a>
</li>
<li v-if="pages > 1"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >next</a></li>
</ul>
</div>

</section>

js:

/查詢相關(guān)新聞種類下的所有新聞記錄
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;
//循環(huán)內(nèi)容
 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;
//循環(huán)內(nèi)容
 vm.pages = data.totalPage;
//總頁碼
 vm.currentPage = data.currentPage;
//當前頁(添加高亮樣式)
}); //end post
 } //end method
 }
 }); //end vue

java后臺:

package com.zrq.util;

import java.util.List;

import org.springframework.stereotype.Component;

@Component
public class PageUtil {
/*
* // 默認的每頁記錄數(shù)量(10條) private static final int DEFAULT_PAGE_SIZE = 10; //
* 默認當前頁 private static final int DEFAULT_CURRENT_PAGE = 1;
*/
// 1.每頁顯示數(shù)量(everyPage)
private int everyPage;
// 2.總記錄數(shù)(totalCount)
private long totalCount;
// 3.總頁數(shù)
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;

/* 獲取總頁數(shù) */
public long getTotalPage() {
long remainder = totalCount % this.getEveryPage(); // 剩余數(shù)
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分頁中單擊頁碼更換頁面內(nèi)容的方法(配合spring springmvc)就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Vue寶典之this.$refs屬性的使用

    Vue寶典之this.$refs屬性的使用

    Vue.js中的refs屬性是一個非常有用的特性,它允許我們在組件中操作 DOM 元素和組件實例,本文來介紹一下Vue寶典之this.$refs屬性的使用,感興趣的可以了解一下
    2023-12-12
  • vue2?對全局自定義指令一次性進行注冊的方法

    vue2?對全局自定義指令一次性進行注冊的方法

    這篇文章主要介紹了vue2?對全局自定義指令一次性進行注冊,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-06-06
  • Vue2+Element-ui實現(xiàn)el-table表格自適應高度的案例

    Vue2+Element-ui實現(xiàn)el-table表格自適應高度的案例

    這篇文章主要介紹了Vue2+Element-ui實現(xiàn)el-table表格自適應高度的案例,本文結(jié)合示例代碼給大家介紹的非常詳細,感興趣的朋友跟隨小編一起看看吧
    2024-06-06
  • 基于Vue3實現(xiàn)印章徽章組件的示例代碼

    基于Vue3實現(xiàn)印章徽章組件的示例代碼

    這篇文章主要介紹了如何利用vue3實現(xiàn)簡單的印章徽章控件,文中通過示例代碼講解詳細,需要的朋友們下面就跟隨小編來一起學習學習吧
    2023-04-04
  • Vue前端如何實現(xiàn)生成PDF并下載功能詳解

    Vue前端如何實現(xiàn)生成PDF并下載功能詳解

    在前端的崗位上經(jīng)常需要實現(xiàn)個生成個并下載的可視化圖表頁PDF文件,這篇文章主要給大家介紹了關(guān)于Vue前端如何實現(xiàn)生成PDF并下載功能的相關(guān)資料,需要的朋友可以參考下
    2021-10-10
  • Vue.js 中的異步組件是什么及使用異步組件的示例

    Vue.js 中的異步組件是什么及使用異步組件的示例

    異步組件是 Vue.js 中提高應用程序性能和加載速度的重要功能之一,在使用異步組件時,需要注意組件的加載時間、錯誤處理和命名規(guī)范等問題,本文將介紹 Vue.js 中異步組件的概念、優(yōu)勢以及如何使用異步組件,感興趣的朋友一起看看吧
    2023-10-10
  • 稍微學一下Vue的數(shù)據(jù)響應式(Vue2及Vue3區(qū)別)

    稍微學一下Vue的數(shù)據(jù)響應式(Vue2及Vue3區(qū)別)

    這篇文章主要介紹了稍微學一下 Vue 的數(shù)據(jù)響應式(Vue2 及 Vue3),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2019-11-11
  • vue中el-input綁定鍵盤按鍵(按鍵修飾符)

    vue中el-input綁定鍵盤按鍵(按鍵修飾符)

    這篇文章主要介紹了vue中el-input綁定鍵盤按鍵(按鍵修飾符),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-07-07
  • Vue中addEventListener()?監(jiān)聽事件案例講解

    Vue中addEventListener()?監(jiān)聽事件案例講解

    這篇文章主要介紹了Vue中addEventListener()?監(jiān)聽事件案例講解,包括語法講解和事件冒泡或事件捕獲的相關(guān)知識,本文結(jié)合示例代碼給大家講解的非常詳細,需要的朋友可以參考下
    2022-12-12
  • 詳解使用mpvue開發(fā)github小程序總結(jié)

    詳解使用mpvue開發(fā)github小程序總結(jié)

    這篇文章主要介紹了詳解使用mpvue開發(fā)github小程序總結(jié),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-07-07

最新評論