1.0.4 • Published 4 years ago

m24-vue-pagination v1.0.4

Weekly downloads
23
License
MIT
Repository
github
Last release
4 years ago

vue-pagination

Simple unstyled Vue pagination component.

Installation

npm install --save m24-vue-pagination

Example

import pagination from 'm24-vue-pagination'

new Vue({
  el: '#app',
  data: {
    total: 0,
    currentPage: 1,
    items: [],
  },
  mounted () {
    this.loadData(this.currentPage)
  },
  methods: {
    loadData(page) {
      this.currentPage = page
      const options = {
        params: {
          page: this.currentPage
        }
      }

      window.axios.get('/getData', options)
        .then(response => {
          this.items = response.data.data
          this.total = response.data.paginate.total
         })
    }
  },
  components: {
    pagination
  }
})
<body id="app">
  <ul class="list-group">
    <li class="list-group-item" v-for="item in items">{{ item.name }}</li>
  </ul>

  <pagination
    :total="total"
    :page="currentPage"
    @page-change="loadData" />
</body>

Props

NameTypeDefaultRequiredDescription
totalNumbertrueTotal number of items
pageNumber0The current page number
perPageNumber10Number of items per page
maxShownNumber5Number of items shown on each site
navBackString«Back indicator (can be HTML, such as svg, icon...)
navFrontString»Forward indicator (can be HTML, such as svg, icon...)

Events

NameReturnsDescription
page-changeselected pageEvent that sends back the selected page

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.1-security

4 years ago