bootstrap-vue
Version:
BootstrapVue, with over 40 plugins and more than 80 custom components, custom directives, and over 300 icons, provides one of the most comprehensive implementations of Bootstrap v4 components and grid system for Vue.js. With extensive and automated WAI-AR
30 lines (27 loc) • 891 B
JavaScript
export default {
props: {
perPage: {
type: [Number, String],
default: 0
},
currentPage: {
type: [Number, String],
default: 1
}
},
computed: {
localPaging: function localPaging() {
return this.hasProvider ? !!this.noProviderPaging : true;
},
paginatedItems: function paginatedItems() {
var items = this.sortedItems || this.filteredItems || this.localItems || [];
var currentPage = Math.max(parseInt(this.currentPage, 10) || 1, 1);
var perPage = Math.max(parseInt(this.perPage, 10) || 0, 0); // Apply local pagination
if (this.localPaging && !!perPage) {
// Grab the current page of data (which may be past filtered items limit)
items = items.slice((currentPage - 1) * perPage, currentPage * perPage);
} // Return the items to display in the table
return items;
}
}
};