-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
62 lines (56 loc) · 1.18 KB
/
app.js
File metadata and controls
62 lines (56 loc) · 1.18 KB
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
// app.js
new Vue({
el: '#events',
data: {
event: {
name: '',
description: '',
date: ''
},
events: []
},
methods: {
fetchEvents: function () {
var events = [
{
id: 1,
name: 'TIFF',
description: 'Toronto International Film Festival',
date: '2015-09-10'
},
{
id: 2,
name: 'The Martian Premiere',
description: 'The Martian comes to theatres.',
date: '2015-10-02'
},
{
id: 3,
name: 'SXSW',
description: 'Music, film and interactive festival in Austin, TX.',
date: '2016-03-11'
}
];
this.events = events;
},
mounted: function () {
console.log('run')
this.fetchEvents()
},
addEvent: function () {
if (this.event.name) {
this.events.push(this.event)
this.event = {
name: '',
description: '',
date: ''
}
}
},
deleteEvent: function (index) {
if (confirm("Are you sure you want to delete this event?")) {
this.events.splice(index, 1)
}
}
}
})