span(@click="product.quantity = Math.max(0, product.quantity - 1)" class="minus") −
input(v-model.number="product.quantity" style="display: inline-block")
span(@click="product.quantity++" class="plus") +
@input="onInput($event, product)"
methods: {
onInput(e, product) {
product.quantity = Math.max(0, parseInt(e.target.value) || 0);
},
},
watch: {
products: {
deep: true,
handler() {
this.products.forEach(n => n.quantity = Math.max(0, parseInt(n.quantity) || 0));
},
},
},