Package Exports
- vue-pagination-2
- vue-pagination-2/src/bus
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vue-pagination-2) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Vue Pagination 2
Note: This package is for use with Vuejs 2. For version 1 please use v-pagination instead.
Simple, generic and non-intrusive pagination component for Vue.js version 2. Presentation is based on bootstrap.
Dependencies
- Vue.js (>=2.0.0-rc.1). Required.
- Bootstrap (CSS). Optional.
Installation
Compile the code using a module bundler, such as webpack or browserify, and the vue jsx transform
npm install vue-pagination-2import the script and the event bus:
import VuePagination from 'vue-pagination-2';
import bus from 'vue-pagination-2/src/bus'Usage
Register the component(s)
Vue.use(VuePagination)HTML:
<pagination for="some-entity" :records="500"></pagination>props:
forstringrequiredunique identifier for the component instance.recordsnumberrequirednumber of recordsper-pagenumberoptionalrecords per page. Default: 25chunknumberoptionalmax pages per chunk. Default: 10count-textstringoptionaltotal records text. Default: '{count} records'
When a page is selected an event will be dispatched, using the unique id for the component. Listen to it on your bus and respond accordingly:
bus.$on('vue-pagination::some-entity', function(page) {
// display the relevant records using the page param
});Programmatic Manipulation
To programmatically set the page apply a ref identifier to the component and call setPage on it:
<pagination ref="pagination" for="some-entity" :records="500"></pagination>
this.$refs.pagination.setPage(1)