From 53dcc8a325a46b589221b723e2bc7d5625a2836f Mon Sep 17 00:00:00 2001 From: nat Date: Mon, 24 Jan 2022 14:21:24 -0300 Subject: [PATCH] Detalles de producto --- public/js/app.js | 3 ++ public/js/productos.js | 69 ++++++++++++++++++++++++++++- resources/views/productos.blade.php | 1 + 3 files changed, 72 insertions(+), 1 deletion(-) diff --git a/public/js/app.js b/public/js/app.js index 38d9e2f..bc6b194 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -62,6 +62,9 @@ Vue.component('nav-migas', { Event.$on('migas-reset', () => { this.migas = []; }); + Event.$on('migas-pop', () => { + this.migas.pop(); + }); } }); diff --git a/public/js/productos.js b/public/js/productos.js index be85243..3d58f65 100644 --- a/public/js/productos.js +++ b/public/js/productos.js @@ -44,7 +44,7 @@ Vue.component('productos-container', {
-
+
@@ -100,5 +100,72 @@ Vue.component('productos-container', { this.visible = true; Event.$emit("migas-agregar",this.miga); }); + }, + methods: { + seleccionarProducto(producto) { + Event.$emit("producto-seleccionado",producto); + } + } +}); + +Vue.component('producto-container', { + template: ` +
+ + +
`, + data() { + return { + producto: null, + visible: false + } + }, + computed: { + miga: function(){ + return { + nombre: this.producto.nombre, + href: "#" + this.producto.nombre + } + } + }, + methods: { + cerrar() { + this.visible = false; + Event.$emit("migas-pop"); + } + }, + mounted() { + Event.$on('producto-seleccionado', (producto) => { + this.producto = producto; + this.visible = true; + Event.$emit("migas-agregar",this.miga); + }); } }); \ No newline at end of file diff --git a/resources/views/productos.blade.php b/resources/views/productos.blade.php index 6234720..906384a 100644 --- a/resources/views/productos.blade.php +++ b/resources/views/productos.blade.php @@ -7,6 +7,7 @@ @section('content') + @endsection @section('scripts')