-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathshoppinglist.js
52 lines (49 loc) · 1.05 KB
/
shoppinglist.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Vue Material plugin
Vue.use(VueMaterial);
const sampleShoppingList = {
"_id": "",
"type": "list",
"version": 1,
"title": "",
"checked": false,
"place": {
"title": "",
"license": null,
"lat": null,
"lon": null,
"address": {}
},
"createdAt": "",
"updatedAt": ""
};
// Vue Material theme
Vue.material.registerTheme('default', {
primary: 'blue',
accent: 'white',
warn: 'red',
background: 'grey'
});
var app = new Vue({
el: '#app',
data: {
pagetitle: 'Shopping Lists',
shoppingLists: [],
shoppingListItems: [],
mode: 'showlist',
singleList: null
},
methods: {
onClickAddShoppingList: function() {
// open shopping list form
this.pagetitle = 'New Shopping List';
this.mode='addlist';
this.singleList = JSON.parse(JSON.stringify(sampleShoppingList));
this.singleList._id = 'list:' + cuid();
this.singleList.createdAt = new Date().toISOString();
},
onBack: function() {
this.mode='showlist';
this.pagetitle='Shopping Lists';
}
}
});