-
Notifications
You must be signed in to change notification settings - Fork 0
/
computed_properties.html
44 lines (42 loc) · 1.04 KB
/
computed_properties.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
<!DOCTYPE html>
<html>
<head>
<title>Vue 2</title>
<style type="text/css">
</style>
</head>
<body>
<div id="root">
<h2>All Tasks</h2>
<ul>
<li v-for="task in tasks" v-text="task.description"></li>
</ul>
<h2>Incompleted Tasks</h2>
<ul>
<!--<li v-for="task in tasks" v-if="!task.completed" v-text="task.description"></li>-->
<li v-for="task in incompleteTasks" v-text="task.description"></li>
</ul>
</div>
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<script type="text/javascript">
new Vue({
el: '#root',
data: {
tasks: [
{ description: 'Go to the gym', completed: true },
{ description: 'Go to ofice', completed: true },
{ description: 'Finish story points ', completed: true },
{ description: 'Go for table tennis', completed: false },
{ description: 'Go to the dinner', completed: false },
{ description: 'Read a Book', completed: false },
]
},
computed: {
incompleteTasks() {
return this.tasks.filter(task => ! task.completed)
}
}
})
</script>
</body>
</html>