-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvueguide-lists.js
119 lines (110 loc) · 2.35 KB
/
vueguide-lists.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*global Vue*/
"use strict";
var example1 = new Vue({
el: '#example-1',
data: {
items: [
{message: 'Foo'},
{message: 'Bar'}
]
}
});
var example2 = new Vue({
el: '#example-2',
data: {
parentMessage: 'Parent',
items: [
{message: 'Foo'},
{message: 'Bar'}
]
}
});
var example =
new Vue({
el: '#v-for-object',
data: {
object: {
firstName: 'John',
lastName: 'Doe',
age: 30
}
}
});
var exampleFiltered = new Vue({
el: '#example-filtered',
data: {
numbers: [1, 2, 3, 4, 5]
},
computed: {
eventNumbers: function () {
return this.numbers.filter(function (number) {
return number % 2 === 0;
});
}
},
methods: {
even: function (numbers) {
return numbers.filter(function (number) {
return number % 2 === 0;
});
}
}
});
// TODO: report vue instance needed
new Vue({
el: "#example-range"
});
new Vue({
el: '#example-template',
data: {
items: [{msg: 'Foo'}, {msg: 'Bar'}]
}
});
var exampleConditional = new Vue({
el: '#example-conditional',
data: {
todos: [
{text: 'Learn Javascript', isComplete: true},
{text: 'Learn Vue', isComplete: false},
{text: 'Build something awesome', isComplete: false}
]
}
});
Vue.component('todo-item', {
template: '<li>' +
'{{ title }}' +
'<button v-on:click="vuemit(\'remove\')">X</button>' +
'</li>',
props: ['title']
});
var todoListExample = new Vue({
el: '#todo-list-example',
data: {
newTodoText: '',
todos: [
{
id: 1,
title: 'Do the dishes'
},
{
id: 2,
title: 'Take out the trash'
},
{
id: 3,
title: 'Mow the lawn'
}
],
nextTodoId: 4
},
methods: {
addNewTodo: function () {
this.todos.push({
id: this.newTodoId,
title: this.newTodoText
});
this.newTodoId += 1;
this.nextTodoText = '';
}
}
});