-
Notifications
You must be signed in to change notification settings - Fork 476
/
005 两栏式与 vue.html
executable file
·97 lines (90 loc) · 2.15 KB
/
005 两栏式与 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 lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="vue.js"></script>
<style type="text/css">
#Header {
width: 360px;
height: 80px;
text-align: center;
line-height: 80px;
font-size: 15px;
color: #fffaf3;
font-weight: bold;
background-color: #f9c81e;
}
#Sidebar {
width: 120px;
float: left;
height: 280px;
text-align: center;
line-height: 280px;
font-size: 15px;
color: #ffffff;
font-weight: bold;
background-color: #cecece;
}
#body {
width: 240px;
height: 280px;
text-align: center;
line-height: 280px;
font-size: 15px;
color: #f9c81e;
font-weight: bold;
background-color: #fffaf3;
float: left;
}
#Footer {
width: 360px;
height: 80px;
text-align: center;
line-height: 80px;
font-size: 15px;
color: #fffaf3;
font-weight: bold;
background-color: #f9c81e;
}
</style>
</head>
<body>
<!----------------view 宣告自定义的元素-->
<div id="app">
<app-header></app-header>
<app-sidebar></app-sidebar>
<app-body></app-body>
<div style='clear:both;'></div>
<app-footer></app-footer>
</div>
<!---------------- VUE-->
<script>
// 定义 (用 Vue.extend() 创建一个组件构造器)
var appHeader = Vue.extend({
template: '<div id="Header">上方列</div>'
})
var appSidebar = Vue.extend({
template: '<div id="Sidebar">侧边栏</div>'
})
var appBody = Vue.extend({
template: '<div id="Body">内容</div>'
})
var appFooter = Vue.extend({
template: '<div id="Footer">页尾资讯</div>'
})
// 注册 (要把这个构造器用作组件,需要用 Vue.component(tag, constructor) 注册 :)
// 注意!组件注册后,会去替换 自定义的元素
Vue.component('app-header', appHeader)
Vue.component('app-sidebar', appSidebar)
Vue.component('app-body', appBody)
Vue.component('app-footer', appFooter)
// 创建根实例
new Vue({
el: '#app'
})
</script>
</body>
</html>
<!--
-->