bootstrap-vue
Version:
With more than 85 components, over 45 available plugins, several directives, and 1000+ icons, BootstrapVue provides one of the most comprehensive implementations of the Bootstrap v4 component and grid system available for Vue.js v2.6, complete with extens
32 lines (29 loc) • 977 B
JavaScript
import { mathMax } from '../../../utils/math';
import { toInteger } from '../../../utils/number';
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 = mathMax(toInteger(this.currentPage, 1), 1);
var perPage = mathMax(toInteger(this.perPage, 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;
}
}
};