Vue paginatron
Pagination component built with scoped-slot props for maximum flexibility.
How to Install
npm install vue-paginatron --save
How to use
vue-paginatron exposes several scoped-slot props that you can use to get basic pagination functionality, you have complete control over what is rendered.
Props
- items
Array
: items to be paginated - itemPerPage
Number
: number of items per page - rotate
Boolean
: Wether or not to rotate at the end of the pages
Scoped slots props
- Methods:
setPage
: Sets an specific pagenextPage
: Advance to the next pageprevPage
: Return to the previous page
- Data:
activeItems
: Items shown in the current pagepage
: Current active page
-pages
: Total of pages
-hasPrevPage
: wether or not the current page is the first onehasNextPage
: wether or not the current page is the last one
- Attribute bindings:
prevButtonAttrs
: hides/shows button if there is a previous pagenextButtonAttrs
: hides/shows button if there is a next page
- Event bindings:
prevButtonEvents
: handles click event to go to the next pagenextButtonEvents
: handles click event to go to the previous page
Events
@changed
- Called every time active items has changed
- Payload:
Array
activeItems
of the current page
@next
- Called when method nextPage is called
- Payload:
Object
{ prev, current }
: object with the previous and current page
@previous
- Called when method prevPage is called
- Payload:
{ prev, current }
: object with the previous and current page