-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvueguide-lists.html
85 lines (71 loc) · 2.35 KB
/
vueguide-lists.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<script src="https://unpkg.com/vue"></script>
<script>
Vue.prototype.vuemit = Vue.prototype.$emit;
</script>
<html>
<title>Vue.js guide - lists</title>
<head>
<meta charset="utf-8" />
</head>
<body>
<ul id="example-1">
<li v-for="item in items">
{{ item.message }}
</li>
</ul>
<ul id="example-2">
<li v-for="(item, index) in items">
{{ parentMessage }} - {{ index }} - {{ item.message }}
</li>
</ul>
<ul id="v-for-object" class="demo">
<li v-for="(value, key, index) in object">
{{ index }}. {{ key }}: {{ value }}
</li>
</ul>
<!-- TODO: report that bulshit -->
<!-- <div v-for="(value, key) in object">
{{ key }}: {{ value }}
</div> -->
<!-- <div v-for="(value, key, index) in object">
{{ index }}. {{ key }}: {{ value }}
</div> -->
<ul id="example-filtered">
<li v-for="n of even(numbers)">{{ n }}</li>
</ul>
<!-- TODO: report missing id -->
<div id="example-range">
<span v-for="n in 10">{{ n }} </span>
</div>
<ul id="example-template">
<template v-for="item in items">
<li>{{ item.msg }}</li>
<li class="divider" style="list-style:none; border-bottom: 1px solid black;"></li>
</template>
</ul>
<div id="example-conditional">
<ul v-if="todos.length">
<li v-for="todo in todos" v-if="!todo.isComplete">
{{ todo.text }}
</li>
</ul>
<p v-else>No todos left!</p>
</div>
<div id="todo-list-example">
<input
v-model="newTodoText"
v-on:keyup.enter="addNewTodo"
placeholder="Add a todo">
<ul v-if="todos.length">
<li
is="todo-item"
v-for="(todo, index) in todos"
v-bind:key="todo.id"
v-bind:title="todo.title"
v-on:remove="todos.splice(index, 1)"></li>
</ul>
<p v-else>No todos left!</p>
</div>
</body>
<script src="vueguide-lists.js"></script>
</html>