1.0.3 • Published 8 years ago

vue-laravel-pagination v1.0.3

Weekly downloads
20
License
MIT
Repository
github
Last release
8 years ago

vue-pagination

Vue pagination component for use with Bootstrap and Laravel pagination.

#Installation

npm install vue-laravel-pagination

// You have to add this package as component to your vuejs installation
Vue.component('pagination', require('vue-laravel-pagination'));

#Usage For making this component to work you need to provide an pagination object with these data members (all required)

  pagination: {
      total: 0,  // total number of elements or items
      per_page: 12, // items per page
      current_page: 1, // current page (it will be automatically updated when users clicks on some page number).
      total_pages: 10 // total pages in record
  }
  

Note that you must set current_page to 1 initially.

Example

  <pagination :pagination="pagination" navClass="anyclass" size="pagination-sm" :callback="loadData" :offset="3"></pagination>

  will gerenate like 

  <nav class="anyclass">
  <ul class="pagination pagination-sm">
    <li>
      ...
    </li>
  </ul>
</nav>

Options

NameTypeDefaultRequiredDescription
paginationObjecttruePagination object used to create pagination
callbackFunctiontrueCallback function used to load data for selected page
offsetNumber4falseLeft and right offset of pagination numbers to display
navClassStringfalseAssign a class to your nav element of pagination
sizeStringfalseGive bootstrap or custom class for sizing your pagination

I will update more info soon...