forked from nathalie/pedi2
Auto sincronziar producto después de 3 segundos
This commit is contained in:
parent
1586a1190a
commit
80a28f4162
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="field has-addons">
|
<div class="field has-addons">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<button class="button is-small" @click.capture="decrementar();">
|
<button :disabled="cantidad < 1" class="button is-small" @click.capture="decrementar();">
|
||||||
<i class="fa fa-solid fa-minus"></i>
|
<i class="fa fa-solid fa-minus"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -50,9 +50,18 @@
|
||||||
methods: {
|
methods: {
|
||||||
decrementar() {
|
decrementar() {
|
||||||
this.cantidad -= 1;
|
this.cantidad -= 1;
|
||||||
|
this.programarSincronizacion();
|
||||||
},
|
},
|
||||||
incrementar() {
|
incrementar() {
|
||||||
this.cantidad += 1;
|
this.cantidad += 1;
|
||||||
|
this.programarSincronizacion();
|
||||||
|
},
|
||||||
|
programarSincronizacion() {
|
||||||
|
setTimeout(() => {
|
||||||
|
if (this.hayCambios()) {
|
||||||
|
this.confirmar();
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
},
|
},
|
||||||
confirmar() {
|
confirmar() {
|
||||||
Event.$emit('sync-subpedido', this.cantidad, this.producto.id);
|
Event.$emit('sync-subpedido', this.cantidad, this.producto.id);
|
||||||
|
|
Loading…
Reference in New Issue