vue-paginate icon indicating copy to clipboard operation
vue-paginate copied to clipboard

If item array is empty, newly added item append to 2nd page

Open rassemdev opened this issue 6 years ago • 1 comments

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: " ", …}

rassemdev avatar May 20 '18 04:05 rassemdev

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.

brjohnson4 avatar Jun 23 '18 14:06 brjohnson4