-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy path04-data-function.html
More file actions
52 lines (43 loc) · 889 Bytes
/
Copy path04-data-function.html
File metadata and controls
52 lines (43 loc) · 889 Bytes
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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.3.4/vue.js"></script>
<title>Component</title>
<style>
#app {
margin: 1em;
font-size: 1.2em;
}
.component {
border: 1px solid #000;
padding: 10px;
}
</style>
</head>
<body>
<div id="app">
{{ msg }}
<hr>
<my-component></my-component>
</div>
<script>
// register
Vue.component('my-component', {
template: '<div class="component">{{ msg }}</div>',
data: function() {
return {
msg: 'A custom component of Vue!'
}
}
});
// create a root instance
new Vue({
el: '#app',
data: {
msg: 'A root msg of Vue!'
}
});
</script>
</body>
</html>