s6e93 components locally and globally

This commit is contained in:
Tyrel Souza 2018-04-16 23:19:06 -04:00
parent 74fccdfb14
commit 1f786d3e39
No known key found for this signature in database
GPG Key ID: 5A9394D4C30AEAC0
2 changed files with 26 additions and 6 deletions

View File

@ -1,4 +1,4 @@
Vue.component('ts-cmp', {
var component = {
data() {
return {status: 'Critical'};
},
@ -8,9 +8,26 @@ Vue.component('ts-cmp', {
this.status = 'Normal';
}
}
});
};
var app = new Vue({
el: '#app',
var component2 = {
template: '<span>butts</span>',
};
var app1 = new Vue({
el: '#app1',
components: {
'ts-cmp': component
}
});
var app2 = new Vue({
el: '#app2',
components: {
'ts-cmp': component2
}
});

View File

@ -6,13 +6,16 @@
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id='app'>
<div id='app1'>
<ts-cmp></ts-cmp>
<hr>
<ts-cmp></ts-cmp>
</div>
<div id='app'>
<div id='app2'>
<ts-cmp></ts-cmp>
<hr>
<ts-cmp></ts-cmp>
</div>
<script src="app.js" charset="utf-8"></script>
</body>