最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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 單文件中的數(shù)據(jù)傳遞示例

    Vue 單文件中的數(shù)據(jù)傳遞示例

    本篇文章主要介紹了Vue 單文件中的數(shù)據(jù)傳遞示例,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-03-03
  • Vue登錄攔截 登錄后繼續(xù)跳轉(zhuǎn)指定頁面的操作

    Vue登錄攔截 登錄后繼續(xù)跳轉(zhuǎn)指定頁面的操作

    這篇文章主要介紹了Vue登錄攔截 登錄后繼續(xù)跳轉(zhuǎn)指定頁面的操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-08-08
  • vue之原生上傳圖片加水印并壓縮圖片大小方式

    vue之原生上傳圖片加水印并壓縮圖片大小方式

    文章介紹了如何使用Vue原生上傳圖片,并在圖片上添加水印并壓縮圖片大小,首先,安裝了相應(yīng)的插件并進行封裝,然后,介紹了添加水印的方法和上傳圖片的過程,最后,作者分享了自己的經(jīng)驗,并希望對大家有所幫助
    2025-01-01
  • Vue使用vue-area-linkage實現(xiàn)地址三級聯(lián)動效果的示例

    Vue使用vue-area-linkage實現(xiàn)地址三級聯(lián)動效果的示例

    很多時候我們需要使用地址三級聯(lián)動,即省市區(qū)三級聯(lián)動,這篇文章主要介紹了Vue使用vue-area-linkage實現(xiàn)地址三級聯(lián)動效果的示例,感興趣的小伙伴們可以參考一下
    2018-06-06
  • vue修改vue項目運行端口號的方法

    vue修改vue項目運行端口號的方法

    本篇文章主要介紹了vue修改vue項目運行端口號的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-08-08
  • setup+ref+reactive實現(xiàn)vue3響應(yīng)式功能

    setup+ref+reactive實現(xiàn)vue3響應(yīng)式功能

    這篇文章介紹了通過setup+ref+reactive實現(xiàn)vue3響應(yīng)式功能,文中通過示例代碼介紹的非常詳細。對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-11-11
  • Vue中插槽和過濾器的深入講解

    Vue中插槽和過濾器的深入講解

    Vue插槽,是學(xué)習(xí)vue中必不可少的一節(jié),越來越發(fā)現(xiàn)插槽的好用,而過濾數(shù)據(jù)也是我們?nèi)粘i_發(fā)中必然會用到的,這篇文章主要給大家介紹了關(guān)于Vue插槽和過濾器的相關(guān)資料,文中通過示例代碼介紹的非常詳細,需要的朋友可以參考下
    2021-07-07
  • Vue中使用正則表達式進行文本匹配和處理的方法小結(jié)

    Vue中使用正則表達式進行文本匹配和處理的方法小結(jié)

    正則表達式在Vue中具有廣泛的應(yīng)用場景,包括文本匹配和處理、表單驗證等,通過本文的介紹和示例,希望讀者能更好地理解和應(yīng)用正則表達式在Vue中的使用方法,感興趣的朋友一起看看吧
    2023-11-11
  • Vue 父子組件實現(xiàn)數(shù)據(jù)雙向綁定效果的兩種方式(案例代碼)

    Vue 父子組件實現(xiàn)數(shù)據(jù)雙向綁定效果的兩種方式(案例代碼)

    本文給大家分享Vue 父子組件實現(xiàn)數(shù)據(jù)雙向綁定效果的兩種方式,方式一是通過監(jiān)聽事件實現(xiàn)方式二是通過 v-model 實現(xiàn),每種方式結(jié)合實例代碼給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友參考下吧
    2022-11-11
  • vue3中的hook簡單封裝

    vue3中的hook簡單封裝

    這篇文章主要介紹了vue3中的hook簡單封裝,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-04-04

最新評論

吉安市| 乌恰县| 四子王旗| 万山特区| 贵州省| 普洱| 陆河县| 正蓝旗| 沈阳市| 象州县| 开远市| 新平| 花莲市| 云和县| 衡阳县| 隆安县| 桐柏县| 双辽市| 大理市| 佛山市| 盐城市| 礼泉县| 拜城县| 莱州市| 集贤县| 綦江县| 文水县| 宁阳县| 集安市| 湘乡市| 教育| 济源市| 察雅县| 永嘉县| 公主岭市| 日照市| 莒南县| 海口市| 巴塘县| 高台县| 高平市|