1.beforeCreate: 創(chuàng)建了Vue組件實(shí)例响蓉,但是組件屬性還未初始化始赎。比如迹炼,data, elt等為undefined。
2.created: 初始化數(shù)據(jù)對(duì)象和事件裂垦,例如:可以訪問屬性this.$data顺囊。這時(shí)最適合做ajax請(qǐng)求,初始化需要渲染的數(shù)據(jù)蕉拢。
3.beforeMount: 進(jìn)行模板編譯特碳,但是,模板內(nèi)容還未插入頁面DOM中晕换。
4.mounted: 將生成好的的模板掛載在DOM樹上午乓,并且,組件屬性this.$el被賦值
5.beforeUpdate: 組件更新之前
6.updated: 組件更新之后
7.beforeDestory: 組件銷毀之前闸准,這時(shí)益愈,已經(jīng)調(diào)用this.$destory()
8.destoryed: 組件銷毀完畢。這時(shí)夷家,組件上的watcher蒸其,子組件和事件監(jiān)聽都會(huì)被銷毀