-
Notifications
You must be signed in to change notification settings - Fork 476
/
Copy path4-1 Compilation Scope.html
83 lines (77 loc) · 1.66 KB
/
4-1 Compilation Scope.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
<!DOCTYPE html>
<html lang="en">
<!--vue.js 013 组件 4-1 Compilation Scope -->
<head>
<script type="text/javascript" src="vue.js"></script>
<meta charset="UTF-8">
<title>vue.js</title>
<style>
.component1 {
margin: 10px 10px 10px 100px;
display: block;
background-color: #ffcc66;
}
.component2 {
background-color: yellow;
padding: 10px;
margin: 10px;
}
</style>
</head>
<body>
<div id="vm">
<app>
</app>
</div>
<template id="app-header">
<div>
{{msg}}
</div>
</template>
<template id="app-footer">
<div>
{{msg}}
</div>
</template>
<template id="app">
<div>
<!--tag 的组成 demo -->
{{msg}}
<app-header></app-header>
<app-footer></app-footer>
</div>
</template>
<script>
Vue.component('app-header', {
template: '#app-header',
data: function() {
return {
msg: 'app-header 台湾小凡',
}
},
});
Vue.component('app-footer', {
template: '#app-footer',
data: function() {
return {
msg: 'app-footer 感谢 群友'
}
},
});
Vue.component('app', {
template: '#app',
data: function() {
return {
msg: '-app-'
}
},
});
var vm = new Vue({
el: '#vm',
data: {
msg: []
},
});
</script>
</body>
</html>