New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

m24-vue-pagination

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

m24-vue-pagination

Simple Vue.js pagination

1.0.4
latest
Source
npm
Version published
Weekly downloads
9
Maintainers
1
Weekly downloads
 
Created
Source

vue-pagination

Simple unstyled Vue pagination component.

Software License Packagist

  • Vue.js (tested with 2.6.11).

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.

Keywords

vue

FAQs

Package last updated on 27 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts