欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來(lái)到入門(mén)教程網(wǎng)!

JavaScript

當(dāng)前位置:主頁(yè) > 網(wǎng)絡(luò)編程 > JavaScript >

vue分頁(yè)插件的使用方法

來(lái)源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:JavaScript|點(diǎn)擊: 次

本文實(shí)例為大家分享了vue分頁(yè)插件的具體代碼,供大家參考,具體內(nèi)容如下

分頁(yè)插件代碼:

<div>
  <div class="page">
   <div class="pagelist">
      <span class="jump" :class="{disabled:pstart}" @click="lessPage()">上一頁(yè)</span>
      <span v-show="current_page>5" class="jump" @click="jumpPage(1)">1</span>
      <span class="ellipsis" v-show="efont">...</span>
      <span class="jump" v-for="num in indexs" :class="{bgprimary:current_page==num}"
        @click="jumpPage(num)">{{num}}</span>
      <span class="ellipsis" v-show="ebehind">...</span>
 
      <span :class="{disabled:pend}" class="jump" @click="addPage()">下一頁(yè)</span>
      <span v-show="current_page<pages-4" class="jump" @click="jumpPage(pages)">{{pages}}</span>
 
     <#--<span class="jumppoint">跳轉(zhuǎn)到:</span>-->
     <#--<span class="jumpinp"><input type="text" v-model="changePage"></span>-->
     <#--<span class="jump gobtn" @click="jumpPage(changePage)">GO</span>-->
   </div>
  </div>
</div>

vue代碼

data: {
  current_page: result.resultObj.number + 1, //當(dāng)前頁(yè)
  pages: result.resultObj.totalPages, //總頁(yè)數(shù)
  changePage: '',//跳轉(zhuǎn)頁(yè)
  nowIndex: 0
    },
  computed: {
    show: function () {
     return this.pages && this.pages != 1
   },
  pstart: function () {
    return this.current_page == 1;
   },
  pend: function () {
    return this.current_page == this.pages;
     },
   efont: function () {
    if (this.pages <= 7) return false;
      return this.current_page > 5
     },
   ebehind: function () {
      if (this.pages <= 7) return false;
      var nowAy = this.indexs;
      return nowAy[nowAy.length - 1] != this.pages;
     },
    indexs: function () {
 
      var left = 1,
        right = this.pages,
        ar = [];
   if (this.pages >= 7) {
     if (this.current_page > 5 && this.current_page < this.pages -4){
        left = Number(this.current_page) - 3;
        right = Number(this.current_page) + 3;
       } else {
        if (this.current_page <= 5) {
         left = 1;
         right = 7;
        } else {
         right = this.pages;
 
         left = this.pages - 6;
        }
       }
      }
    while (left <= right) {
       ar.push(left);
       left++;
      }
      return ar;
     },
    },
    methods: {
     jumpPage: function (id) {
      if (id <= this.pages && id >= 1) {
       this.current_page = id;
       loadData(this.current_page - 1, size);
      }
     },
    lessPage: function () {
      this.current_page--;
      loadData(this.current_page - 1, size);
     },
    addPage: function () {
      this.current_page++;
      loadData(this.current_page - 1, size);
   }
}

使用說(shuō)明:

直接拷貝即可使用,只需要修改總頁(yè)數(shù)、當(dāng)前頁(yè)。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持我們。

上一篇:JS實(shí)現(xiàn)簡(jiǎn)易留言板特效

欄    目:JavaScript

下一篇:微信小程序如何獲取地址

本文標(biāo)題:vue分頁(yè)插件的使用方法

本文地址:http://mengdiqiu.com.cn/a1/JavaScript/9402.html

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語(yǔ)言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有