侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

vue分页插件的使用方法

前端  /  管理员 发布于 3年前   246

本文实例为大家分享了vue分页插件的具体代码,供大家参考,具体内容如下

分页插件代码:

  
上一页 1 ... {{num}} ... 下一页 {{pages}} <#--跳转到:--> <#----> <#--GO-->

vue代码

data: {  current_page: result.resultObj.number + 1, //当前页  pages: result.resultObj.totalPages, //总页数  changePage: '',//跳转页  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);   }}

使用说明:

直接拷贝即可使用,只需要修改总页数、当前页。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

您可能感兴趣的文章:

  • Vue分页插件的前后端配置与使用
  • Vue引用Swiper4插件无法重写分页器样式的解决方法
  • vue中的自定义分页插件组件的示例
  • 基于vue.js的分页插件详解
  • VUEJS实战之利用laypage插件实现分页(3)


  • 上一条:
    vue远程加载sfc组件思路详解
    下一条:
    PHP实现微信小程序用户授权的工具类示例
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • 如何优雅处理async await错误推荐:await-to-js库(0个评论)
    • lodash工具库(0个评论)
    • nginx + vue配置实现同域名下不同路径访问不同项目(0个评论)
    • 在js中使用URL类用来解析处理URL的示例代码(0个评论)
    • js中动画事件:requestAnimationFrame、transitionend、animation...(0个评论)
    • 近期文章
    • 如何优雅处理async await错误推荐:await-to-js库(0个评论)
    • lodash工具库(0个评论)
    • 在Laravel项目中使用中间件方式统计用户在线时长功能代码示例(0个评论)
    • 在Laravel中构建业务流程模型(0个评论)
    • windows系统中安装FFMpeg及在phpstudy环境php7.3 + php-ffmpeg扩展的使用流程步骤(0个评论)
    • 在go语言中对浮点的数组、切片(slice)进行正向排序和反向排序(0个评论)
    • 在go语言中对整数数组、切片(slice)进行排序和反向排序(0个评论)
    • 在go语言中对字符串数组、切片(slice)进行排序和反向排序(0个评论)
    • 最新国内免注册ChatGPT体验站_ChatGPT镜像站访问链接地址2023/3/28持续更新(0个评论)
    • 在Laravel项目中的实现无密码认证之:发送邮箱链接授权(0个评论)
    • 近期评论
    • 博主 在

      2023年国务院办公厅春节放假通知:1月21日起休7天中评论 @ xiaoB 你只管努力,剩下的叫给天意;天若有情天亦老,..
    • xiaoB 在

      2023年国务院办公厅春节放假通知:1月21日起休7天中评论 会不会春节放假后又阳一次?..
    • BUG4 在

      你翻墙过吗?国内使用vpn翻墙可能会被网警抓,你需了解的事中评论 不是吧?..
    • 博主 在

      go语言+beego框架中获取get,post请求的所有参数中评论 @ t1  直接在router.go文件中配就ok..
    • Jade 在

      如何在MySQL查询中获得当月记录中评论 Dear zongscan.com team, We can skyroc..
    • 2016-11
    • 2017-06
    • 2017-07
    • 2017-08
    • 2017-09
    • 2017-10
    • 2017-11
    • 2018-03
    • 2018-04
    • 2018-05
    • 2018-06
    • 2018-09
    • 2018-11
    • 2018-12
    • 2019-02
    • 2020-03
    • 2020-04
    • 2020-05
    • 2020-06
    • 2021-04
    • 2021-05
    • 2021-07
    • 2021-08
    • 2021-09
    • 2021-10
    • 2021-11
    • 2022-08
    • 2022-09
    • 2022-10
    • 2022-11
    • 2022-12
    • 2023-01
    • 2023-02
    • 2023-03
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客