-
Notifications
You must be signed in to change notification settings - Fork 3
/
vue-instance.html
48 lines (42 loc) · 1.11 KB
/
vue-instance.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<meta name="viewport" content="minimal-ui,width=device-width,initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" />
<title>Vue Instance</title>
<script src="vue.js"></script>
</head>
<body>
<div id="app">
Vue Instance
<ul>
<li>constructor</li>
<li>properties & methods</li>
<li>instance lifecycle hooks</li>
</ul>
</div>
<script>
var data = { a: 1 };
var vm = new Vue({
el: '#app',
data: data,
created: function(){
console.log('created');
},
mounted: function(){
console.log('mounted');
},
updated: function(){
console.log('updated');
},
destroyed: function(){
console.log('destroyed');
}
});
console.log(vm.a === data.a);
console.log(vm.$data === data);
vm.$watch('a', function(newVal, oldVal){
});
</script>
</body>
</html>