I have a vue component for which I get paginated data from api.
What I want to do is update the iterated list using a smaller pagination total...thus in my vue component template
<td v-for="item in listItems">......
</td>
and in the script
{
data (){ return { items:[]; pageSize:5, page:1 } // items is 20 in total; pageSize is 5 per page
computed :{
listItems: function(){
var arr = [];
while (i < this.pageSize) {
arr.push(this.items[i + (this.page * this.pageSize)]);
i++;
}
return arr ;
}
},
methods:{
getDATA: function(){ this.$http.get().then(response => {
this.items = response.data.data; // array of data objects
});
}
}
}
but i get an empty array/ i'm guessing I can't just iterate like a normal array