-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathm1.html
66 lines (64 loc) · 2.8 KB
/
m1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inicio</title>
</head>
<body>
<div id="app">
<div class="container-fluid">
<h2>{{titulo}}</h2> <!--asi se pasa info de js a html {{}} -->
<h2>{{message}}</h2> <!--asi se pasa info de js a html {{}} -->
<ul>
<li v-for="i of menu">{{i}}</li>
</ul>
<br>
<h2>Crear Nuevo Producto</h2>
<input type="text" v-model="nuevo" placeholder="Nombre"> <!--Asi se envia info 'v-model'-->
<input type="text" v-model="valor" placeholder="Precio">
<button @click="agregarProducto">Agregar</button>
<br><br><br>
<table class="table table-hover table-dark">
<thead>
<tr>
<th scope="col">Nombre</th>
<th scope="col">Precio</th>
<th scope="col">Stock</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) of productos" :key="index">
<td>
<input type="text" v-model="item.nombre" :readonly="!item.editable">
</td>
<td>
<input type="number" v-model.number="item.precio" :readonly="!item.editable">
</td>
<td>
<input type="number" v-model.number="item.stock" :readonly="!item.editable">
<span v-if="item.stock === 0">Sin Unidades</span>
<span v-else>Und</span>
</td>
<td>
<button @click="toggleEdit(index)">{{ item.editable ? 'Terminar Edición' : 'Editar' }}</button>
<button @click="eliminarProducto(index)">Eliminar</button>
</td>
</tr>
<tr>
<td>Totales</td>
<td>{{sumarPrecio}}</td>
<td>{{sumarStock}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script src="/m1.js"></script>
</body>
</html>