We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b5de32 commit d27f46dCopy full SHA for d27f46d
index.html
@@ -98,7 +98,7 @@ <h1>Cart</h1>
98
99
<tr>
100
<td colspan="2"></td>
101
- <td><button class="btn btn-success">Checkout</button></td>
+ <td><button class="btn btn-success" @click="checkout">Checkout</button></td>
102
</tr>
103
</tbody>
104
</table>
js/app.js
@@ -92,6 +92,15 @@ new Vue({
92
if (index !== -1) {
93
this.cart.items.splice(index, 1);
94
}
95
+ },
96
+ checkout: function() {
97
+ if (confirm('Are you sure that you want to purchase these products?')) {
+ this.cart.items.forEach(function(item) {
+ item.product.inStock += item.quantity;
+ });
+
+ this.cart.items = [];
+ }
105
},
106
computed: {
0 commit comments