-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.html
97 lines (86 loc) · 1.66 KB
/
vue.html
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
<!DOCTYPE html>
<html>
<head>
<script src="vue.min.js"></script>
<title></title>
<script type="text/javascript">
window.onload = function() {
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: true
}
});
var app4 = new Vue({
el: '#app-4',
data: ({
// people:[{'name': 'Tom'},{'name': 'Jerry'},{'name': 'Kitty'}]
people:['Tom', 'Jerry', 'Kitty']
})
})
var app5 = new Vue({
el: '#app-5',
data: ({
message: '1234567890'
}),
methods:{
reverseMessage: function(argument) {
this.message = this.message.split('').reverse().join('');
}
}
})
var app6 = new Vue({
el: '#app-6',
data: ({
message: 'aha'
})
})
Vue.component('todo',{
template: '<div>哈哈哈哈啊</div>'
})
}
</script>
</head>
<body>
<!-- 声明式渲染 -->
<div id="app">
{{message}}
</div>
<div id="app-2">
<span v-bind:title="message">
鼠标悬停几秒钟查看此处动态绑定的提示信息!
</span>
</div>
<!-- 条件循环 -->
<div id="app-3">
<p v-if="seen">现在你看到我了</p>
</div>
<div id="app-4">
<ul>
<li v-for="person in people">{{person}}</li>
</ul>
</div>
<div id="app-5">
<p>{{ message }}</p>
<button v-on:click="reverseMessage">逆转消息</button>
</div>
<div id="app-6">
<p>{{message}}</p>
<input type="text" v-model="message">
</div>
<!-- 组件化构建 -->
<todo></todo>
</body>
</html>