-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathejemplo5.html
63 lines (58 loc) · 1.9 KB
/
ejemplo5.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ejemplo1</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
</head>
<body>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h1>Curso de vuejs</h1>
<table class="table table-striped">
<tr>
<th>Categoria</th>
<th>Nota</th>
<th width="50px"> </th>
</tr>
<tr v-for="note in notes" is="note-row" :note.sync="note" :categories="categories"></tr>
<tr>
<td><select-category :categories="categories" :id.sync="new_note.category_id"></select-category></td>
<td><input type="text" v-model="new_note.note" class="form-control"></td>
<td><a href="#" @click="createNote()"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></a></td>
</tr>
</table>
</div>
</div>
<pre>{{ $data | json }}</pre>
<template id="select_category_tpl">
<select v-model="id" class="form-control">
<option value="">Selecciona una categoría</option>
<option v-for="category in categories" :value="category.id">
{{ category.name }}
</option>
</select>
</template>
<template id="note_row_tpl">
<tr>
<template v-if="! editing">
<td>{{ note.category_id | category }}</td>
<td>{{ note.note }}</td>
<td>
<a href="#" @click="edit()"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>
<a href="#" @click="remove()"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
</td>
</template>
<template v-else>
<td>
<select-category :categories="categories" :id.sync="note.category_id"></select-category>
</td>
<td><input type="text" v-model="note.note" class="form-control"></td>
<td><a href="#" @click="update()"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></a></td>
</template>
</tr>
</template>
<script src="vue.js"></script>
<script src="main.js"></script>
</body>
</html>