beforeCreate :組件實例剛剛被建立,屬性都尚未vue
created:實例已經建立完成,屬性已經綁定app
beforeMount:模板編譯以前spa
mounted:模板編譯z以後ip
beforeUpdate:組件更新以前io
updated:組件更新完畢console
beforeDestroy:組件銷燬前編譯
destroyed:組件銷燬後function
---------------------------------------------------------------------------------------------------------模板
<div id="app"></div>date
<script>
var app=new Vue({
el:'#app',
beforeCreate:function(){
console.log('實例剛剛被建立');
},
craeted:function(){ //*****經常使用
console.log('實例屬性能夠使用了');
},
beforeMount:function(){
console.log('實例被掛載以前');
},
mounted:function(){ //*****經常使用
console.log('掛載成功,而且模板數據編譯成功');
},
beforeUpdate:function(){ //數據點擊就改變
console.log('數據更新以前');
},
updated:function(){
console.log('數據更新完成');
},
beforeDestroy:function(){
console.log('實例銷燬以前');
},
destroyed:function(){ //vue不會本身銷燬
console.log('實例銷燬以後');
}
})
</script>