s6e91 first component

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

View File

@ -1,35 +1,13 @@
Vue.component('ts-cmp',{
data() {
return {
status: "Critical!",
};
},
template: '<p> Server status {{ status }} </p>'
});
var app = new Vue({
el: '#app',
data: {
title: "The VueJS nstance"
},
beforeCreate(){
console.log("Created");
},
created(){
console.log("created");
},
beforeMount(){
console.log("beforeMount");
},
mounted(){
console.log("mounted");
},
beforeUpdate(){
console.log("before update");
},
updated(){
console.log("updated");
},
beforeDestroy(){
console.log("before destroy");
},
destroyed(){
console.log("destroyed");
},
methods:{
destroy(){
this.$destroy();
}
}
});

View File

@ -7,9 +7,10 @@
</head>
<body>
<div id='app'>
{{title}}
<button @click="title = 'changed'">click</button>
<button @click="destroy"> destroy </button>
<ts-cmp></ts-cmp>
</div>
<div id='app'>
</div>
<script src="app.js" charset="utf-8"></script>
</body>

View File

@ -6,6 +6,7 @@
<script>
export default {
}
</script>