I made a pagination, but there is a problem about slicing the array. Let's say an array
contains 20 objects
inside it. And pagination displays all. 10 per page. The code is right below.
data(){
return {
perPage: 10,
currentPage: 1,
pageIndex: Number,
};
},
computed: {
mainDatas() {
// other codes...
//...
this.pageIndex = this.currentPage * this.perPage;
makeSort = makeSort.slice(this.pageIndex, this.pageIndex + this.perPage);
return makeSort;
},
}
But when I apply filter on the array. And let's say array
now contains 17 objects. Then it's only show sliced first 10, the rest of 7 doesn't display. Next page is doesn't show up.
How can I make paginate without problem? What should I try...