vue-paginate
vue-paginate copied to clipboard
If item array is empty, newly added item append to 2nd page
I have implemented your library, its working good. but the problem is, if i remove all item from the array then add a new one, it append to 2nd page. Instead of first page.
<paginate name="Orders" :list="Orders" class="paginate-list">
<div class="row" v-for="(row, index) in paginated('Orders')">
<div class="col-12 col-sm-12 col-md-4 secondColumn pickupSecondColumn">
<div>
<p class="name">{{row.title}}</p>
<p class="name">Color: {{row.color}}</p>
<p class="name">Cantidad: {{row.quantity}}</p>
</div>
</div>
</div>
</paginate>
<paginate-links for="Orders" :simple="{
next: 'Next »',
prev: '« Back'
}"></paginate-links>
export default {
data() {
//all state
},
methods: {
afterloading() {
let singleProductRoute = "routeLInk";
axios.get(singleProductRoute, {
params: {
id: ID
}
}).then(function(response) {
console.log(response.data);
let singleProductValues = response.data;
outerThis.Orders.push(response.data);
});
}
}
here is the array object: {name: "Comprade Mercado", user: " ", title: " ", color: " ", quantity: " ", …}
See issue #82. Wrapping vue-paginate in a div with v-if="array.length" solved it for me. It's also a great way to display info saying the array is empty.