Paginate an array in your Vuex state
npm install vuex-local-pagination
See examples
directory for usage examples.
The default export is a factory function for creating instances of this module.
import createPagination from 'vuex-local-pagination';
const store = new Vuex.Store({
// ...
modules: {
pagination: createPagination({ pageSize: 15 })
}
});
Index of the first record in the pagination window. Defaults to 0.
Returns: Zero-based number
Size of the pagination window. Initial value is passed in during module creation.
Returns: number
Number of pages given the number of records.
Returns: number
Current page number.
Returns: One-based number
The slice of your records that fall within the pagination window.
Returns: Array of records
Array of page numbers given the number of records.
Returns: Array of one-based numbers
Move pagination window to a specific page.
Required payload:
{
page: <number>
}
Change number of records in a page.
Required payload:
{
pageSize: <number>
}
MIT