File tree 4 files changed +24
-19
lines changed
4 files changed +24
-19
lines changed Original file line number Diff line number Diff line change @@ -2,4 +2,4 @@ module.exports = {
2
2
presets : [
3
3
'@vue/app'
4
4
]
5
- }
5
+ } ;
Original file line number Diff line number Diff line change 2
2
<footer class =" footer" >
3
3
<span class =" todo-count" ><strong >{{ itemsLeft }}</strong ><span > {{ itemText }} left</span ></span >
4
4
<ul class =" filters" >
5
- <li v-for =" filterKey in Object.keys(filterTitles)" :key =" filterKey" >
6
- <a
7
- href =" #"
8
- :class =" { selected: filterKey === filter }"
9
- @click =" onFilterSelect(filterKey)"
10
- >
11
- {{ filterTitles[filterKey] }}
12
- </a >
13
- </li >
5
+ <li v-for =" filterKey in Object.keys(filterTitles)" :key =" filterKey" >
6
+ <a
7
+ href =" #"
8
+ :class =" { selected: filterKey === filter }"
9
+ @click =" onFilterSelect(filterKey)"
10
+ >
11
+ {{ filterTitles[filterKey] }}
12
+ </a >
13
+ </li >
14
14
</ul >
15
15
<button v-if =" !!completedCount" class =" clear-completed" @click =" onClearCompleted" >Clear completed</button >
16
16
</footer >
Original file line number Diff line number Diff line change 1
1
<template >
2
- <section class =" main" >
3
- <input id =" toggle-all" class =" toggle-all" type =" checkbox" />
4
- <label htmlFor =" toggle-all" ></label >
2
+ <section class =" main" >
3
+ <input id =" toggle-all" class =" toggle-all" type =" checkbox" :checked = " areAllCompleted " readonly />
4
+ <label htmlFor =" toggle-all" @click = " onCompleteAll " ></label >
5
5
6
- <ul class =" todo-list" >
7
- <Item v-for =" todo in todos" :key =" todo.id" :todo =" todo" @remove =" onRemove" @update =" onUpdate" />
8
- </ul >
9
- </section >
6
+ <ul class =" todo-list" >
7
+ <Item v-for =" todo in todos" :key =" todo.id" :todo =" todo" @remove =" onRemove" @update =" onUpdate" />
8
+ </ul >
9
+ </section >
10
10
</template >
11
11
12
12
<script >
19
19
Item
20
20
},
21
21
props: [' todos' ],
22
+ computed: {
23
+ areAllCompleted () {
24
+ return this .todos .length && this .todos .every (todo => todo .completed );
25
+ }
26
+ },
22
27
methods: {
23
- ... mapActions ([' onRemove' , ' onUpdate' ])
28
+ ... mapActions ([' onRemove' , ' onUpdate' , ' onCompleteAll ' ])
24
29
}
25
30
};
26
31
</script >
Original file line number Diff line number Diff line change @@ -9,5 +9,5 @@ Vue.use(Vuex);
9
9
10
10
new Vue ( {
11
11
store : storeFactory ( ) ,
12
- render : h => h ( App ) ,
12
+ render : h => h ( App )
13
13
} ) . $mount ( '#app' ) ;
You can’t perform that action at this time.
0 commit comments