Within my application, there is a section for pagination that utilizes data sourced from a REST API. However, I have encountered an issue where the pagination starts counting from page 0 instead of page 1. This results in displaying "0 of 9" initially and reaching "8 of 9" at the end, rather than starting with "1 of 9" and ending with "9 of 9". Below is a snippet of the current implementation:
HTML
<p>Page {{page}} of {{pageCount}}</p>
JS
data: function() {
return {
page: 0
};
},
computed: {
pageCount() {
let l = this.result.length,
s = this.size;
return Math.floor(l / s);
},
paginated() {
const start = this.page * this.size,
end = start + this.size;
return this.result.slice(start, end);
}
},
Could it be possible that the calculation using the Math.floor
method is causing this issue?