1.0.0 • Published 3 years ago

@letrungtan/vue-pagination v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

vue-pagination

A simple pagination component for VueJS.

Installation

NPM

$ npm install @letrungtan/vue-pagination

Use the component.

import Pagination from '@letrungtan/vue-pagination'
Vue.component('pagination', Pagination)

Usage

Basic Usage

<pagination
  :currentPage="1"
  :perPage="20"
  :totalItems="123"  
  @pageSelected="callbackFunction"
>
</pagination>

Example

<template>
  <pagination
    :currentPage="1"
    :perPage="20"
    :totalItems="123"  
    @pageSelected="changePage"
  </pagination>
</template>

<script>
export default {
  methods: {
    changePage (page) => {
      console.log(page);
    }
  }
}
</script>

API

NameTypeDescription
currentPageNumberCurrent page number. required
perPageNumberNumber of item limit per page. required
totalItemsNumberNumber of all item available. required
@pageSelectedFunctionThe callback function when page selected. Return page number in parameter.
prevTextStringText for the previous button. default: Prev
nextTextStringText for the next button. default: Next
maxSizeNumberMax length of pagination. default: 5