<div id="app">
<h1>{{message}}</h1>
</div>
<script>
var vm=new Vue({
data: {
message:'生命周期'
},
beforeCreate() {
console.log("beforeCreate() 被调用了",this.$el,this.$data);
},
created() {
console.log("created() 被调用了",this.$el,this.$data);
},
beforeMount() {
console.log("beforeMount() 被调用了",this.$el,this.$data);
},
Mounted(){
console.log("Mounted() 被调用了",this.$el,this.$data);
},
beforeUpdate() {
console.log("beforeUpdate() 被调用了",this.$el.innerHTML,this.$data);
},
updated() {
console.log("updated() 被调用了",this.$el.innerHTML,this.$data);
},
beforeDestroy() {
console.log("beforeDestroy() 被调用了");
},
destroyed() {
console.log("destroyed() 被调用了");
}
}).$mount('#app');
</script>