Skip to content

Instantly share code, notes, and snippets.

@fredyfx
Created January 2, 2019 11:21
Show Gist options
  • Save fredyfx/6bda8386250a877cdff3c0871637058d to your computer and use it in GitHub Desktop.
Save fredyfx/6bda8386250a877cdff3c0871637058d to your computer and use it in GitHub Desktop.
Parte final del tutorial
<html>
<head>
<script src="~/lib/vue/vue.js"></script>
<script src="~/lib/vue-resource/vue-resource.js"></script>
</head>
<body>
<p>
Index!
</p>
<h1>Lista de productos</h1>
<div id="primervue">
{{titulo}}
</div>
<div id="segundovue">
<form novalidate v-on:submit.prevent="enviarFormulario" >
<input type="hidden" v-model="producto.id" />
<div>
<input type="text" v-model="producto.nombre" placeholder="Nombre" />
</div>
<div>
<input type="text" v-model="producto.stock" placeholder="Stock" />
</div>
<button type="submit" value="Submit">
<span v-if="mostrarBotonRegistrar">Registrar</span>
<span v-else>Guardar</span>
</button>
<button type="button" v-on:click="limpiarFormulario" >Cancelar</button>
</form>
<table style="border-color: black; border-style: solid; border-width: 1px;">
<tr>
<td>Nombre</td>
<td>Stock</td>
<td>¿Tiene Oferta?</td>
<td>Operaciones</td>
</tr>
<tr v-for="producto in productos">
<td>{{producto.nombre}}</td>
<td>{{producto.stock}}</td>
<td>
<span v-if="producto.tieneOferta == true">Si</span>
<span v-else>No</span>
</td>
<td>
<button type="button" v-on:click="obtenerProducto(producto.id)">Editar</button>
<button type="button" v-on:click="eliminarProducto(producto.id)">Eliminar</button>
</td>
</tr>
</table>
</div>
<script src="~/scripts/wasap.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment