s6e92 components with data method

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

View File

@ -1,10 +1,13 @@
Vue.component('ts-cmp', { Vue.component('ts-cmp', {
data() { data() {
return { return {status: 'Critical'};
status: "Critical!",
};
}, },
template: '<p> Server status {{ status }} </p>' template: '<p> Server status {{ status }} <button @click="changeStatus">XXX</button></p>',
methods: {
changeStatus(){
this.status = 'Normal';
}
}
}); });
var app = new Vue({ var app = new Vue({

View File

@ -8,6 +8,8 @@
<body> <body>
<div id='app'> <div id='app'>
<ts-cmp></ts-cmp> <ts-cmp></ts-cmp>
<hr>
<ts-cmp></ts-cmp>
</div> </div>
<div id='app'> <div id='app'>