vue | vue pagination npm
ThisversiononlyworkswithVue2.0.ForVue1.0,checkoutthe1.0branch[1].Theideaofvue-paginateisprettysimple.Yougiveitanarrayofitems;specifyhowmanyitemsperpage;thengetyourlistofitemspaginated!Setupnpminstallvue-paginate--saveYouhavetwowaystosetupvue-paginate:CommonJS(Webpack/Browserify)import VuePaginate from vue-paginateVue.use(VuePaginate)var VuePaginate = require(vue-paginate)Vue.use(VuePaginate)IncludeIncludeitdirectlywitha
This version only works with Vue 2.0. For Vue 1.0, check out the 1.0 branch[1].
The idea of vue-paginate is pretty simple. You give it an array of items; specify how many items per page; then get your list of items paginated!
Setup npm install vue-paginate --saveYou have two ways to setup vue-paginate:
CommonJS (Webpack/Browserify)import VuePaginate from vue-paginate
Vue.use(VuePaginate)
var VuePaginate = require(vue-paginate)
Vue.use(VuePaginate)
IncludeInclude it directly with a <script> tag. In this case, you dont need to write Vue.use(VuePaginate), this will be done automatically for you.
UsageBefore you start, you may want to check a live example on jsfiddle[2].
vue-paginate consists of two main components: Paginate and PaginateLinks. And both get registered globally once the plugin is installed.
To paginate any list of data, we have to follow these three small steps:
Register the name of the...