Auto sincronziar producto después de 3 segundos
This commit is contained in:
		
							parent
							
								
									1586a1190a
								
							
						
					
					
						commit
						80a28f4162
					
				
					 1 changed files with 10 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
<template>
 | 
			
		||||
    <div class="field has-addons">
 | 
			
		||||
        <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>
 | 
			
		||||
            </button>
 | 
			
		||||
        </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -50,9 +50,18 @@
 | 
			
		|||
        methods: {
 | 
			
		||||
            decrementar() {
 | 
			
		||||
                this.cantidad -= 1;
 | 
			
		||||
                this.programarSincronizacion();
 | 
			
		||||
            },
 | 
			
		||||
            incrementar() {
 | 
			
		||||
                this.cantidad += 1;
 | 
			
		||||
                this.programarSincronizacion();
 | 
			
		||||
            },
 | 
			
		||||
            programarSincronizacion() {
 | 
			
		||||
                setTimeout(() => {
 | 
			
		||||
                    if (this.hayCambios()) {
 | 
			
		||||
                        this.confirmar();
 | 
			
		||||
                    }
 | 
			
		||||
                }, 3000);
 | 
			
		||||
            },
 | 
			
		||||
            confirmar() {
 | 
			
		||||
                Event.$emit('sync-subpedido', this.cantidad, this.producto.id);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue