-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
37 lines (36 loc) · 818 Bytes
/
main.js
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
Vue.createApp({
data(){
return{
message: "Shopping List App",
editing: false,
newItem: '',
newItemPriority: false,
items: []
}
},
computed:{
charCount(){
return this.newItem.length
},
reversedItems(){
return [...this.items].reverse()
}
},
methods:{
saveItem(){
this.items.push({
id: this.items.length + 1,
label: this.newItem, highPriority: this.newItemPriority})
this.newItem = ''
this.newItemPriority = ''
},
doEdit(editing){
this.editing = editing
this.newItem = ''
this.newItemPriority = ''
},
togglePurchased(item){
item.purchased = !item.purchased
}
}
}).mount('#shopping-list')