-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
132 lines (117 loc) · 2.29 KB
/
index.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
120
121
122
123
124
125
126
127
128
129
130
131
132
// defines
var root = '/'
if (window.location.host == 'juentingshie.github.io') {
root = 'https://juentingshie.github.io/Vue.js/'
}
// console.log(window.location.host)
// defines
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!'
}
});
var app2 = new Vue({
el: '#app-2',
data: {
message: '網頁載入於 ' + new Date().toLocaleString()
}
});
var app3 = new Vue({
el: '#app-3',
data: {
seen: false
}
});
var app3_1 = new Vue({
el: '#app-3_1',
data: {
seen: false,
message: 'hehehehehehe'
},
methods: {
toggleEle: function () {
this.seen = !this.seen
}
}
})
var app3_2 = new Vue({
el: '#app-3_2',
data: {
message: 'hehehehehehehehe'
}
})
var app4 = new Vue({
el: '#app-4',
data: {
todos: [{
text: '學習 JavaScript'
},
{
text: '學習 Vue'
},
{
text: '整個項目'
}
]
}
});
var app5 = new Vue({
el: '#app-5',
data: {
message: '我的雲端硬碟'
},
methods: {
reverseMessage: function () {
this.message = this.message.split('').reverse().join('')
}
}
});
var app6 = new Vue({
el: '#app-6',
data: {
message: 'Hello Vue!'
}
});
Vue.component('todo-item', {
// todo-item 组件现在接受一个
// "prop",类似于一个自定义 attribute。
// 这个 prop 名为 todo。
props: ['todo'],
template: '<li>{{ todo.text }}</li>'
})
var app7 = new Vue({
el: '#app-7',
data: {
List: [{
id: 0,
text: 'hehe0'
},
{
id: 1,
text: 'hehe1'
},
{
id: 2,
text: 'hehe2'
},
]
}
})
Vue.component('header-items', {
props: ['header'],
// template: '<a href={{ header.url }}>{{ header.text }}</a>'
template: '<li><a :href="`${header.url}`">{{header.text}}</a></li>'
})
var app_header = new Vue({
el: '#header',
data: {
List: [
{ id: 0, text: 'Home', url: root },
{ id: 1, text: 'Netflow', url: root + 'netflow' },
]
}
})
function toggle_seen(element) {
app3.seen = !app3.seen
}