vue原生分页插件

Github:https://github.com/BenBlossom/el-pagination

How to use

npm i el-pagination

Import on your page
import Pagination from 'el-pagination/Pagination'

Attributes
AttributesDescriptionTypeOptional valueDefaults
upNameLeft button valueString-上一页
downNameRight button valueString-下一页
pageCountTotal number of pagesnumber--
pageSizePage length per pagenumberRecommended value greater than 510
currentPageCurrent page count, the default number of pages is started for the first timenumber--
Events
事件名称说明回调参数
clickClicking on the page number will triggercurrentPage
prev-clickClicking on the left button will triggercurrentPage
next-clickClicking on the right button will triggercurrentPage
Example
<template>
  <div>
      <Pagination
      :upName="upName"
      :downName="downName"
      :pageCount ="pageCount"
      :currentPage ="currentPage"
      :pageSize="pageSize"
      @click="click"
      @prev-click="prevClick"
      @next-click="nextClick">
      </Pagination>   
    </div>
  </div>
</template>
<script>
import Pagination from 'el-pagination/Pagination'
export default {
  name: 'About',
  data () {
    return {
      upName: '上一页',
      downName: '下一页',
      pageCount: 20,
      currentPage: 2,
      pageSize: 10
    }
  },
  components: {
    Pagination
  },
  methods: {
    click(page) {
      console.log(page)
    },
    prevClick(page) {
      console.log(page)
    },
    nextClick(page) {
      console.log(page)
    }
  }
}
</script>

if your currentPage is 2 and your pageCount is 20 pagesSize is 10, you will see this picture在这里插入图片描述
this dots is quick skip many page, this skip number depending on your pageCount value, for example, If your pageCount is 20, the skip number is pageCount/2 = 2

if you currentPage is 8, you will see this picture
在这里插入图片描述
look the left dot, this is same as the right dot, the difference is skip left page

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值