vue的生命周期(这篇文章仅做收集之用,整理思路)

vue2的生命周期:
beforeCreate——>created——>beforeMount——>mounted——>beforeUpdate
——>updated——>beforeDestroy——destroyed

var
myVue = new Vue({ el: '#app', data: { data: 'aaaa', info: 'nono' }, beforeCreate: function () { console.log('创建前=======') console.log(this.data) console.log(this.$el) }, created: function () { console.log('已创建==========') console.log(this.info) console.log(this.$el) }, beforeMount: function () { console.log('mount之前=============') console.log(this.info) console.log(this.$el) }, mounted: function () { console.log("mounted==========") console.log(this.info) console.log(this.$el) }, beforeUpdate: function () { console.log('更新前========') }, updated: function () { console.log('更新完成=============') }, beforeDestory: function () { console.log('销毁前============') console.log(this.info) console.log(this.$el) }, destoryed: function () { console.log('已销毁===========') console.log(this.info) console.log(this.$el) } });

 

 

 原博客地址:

posted @ 2017-03-23 14:47  星光璀璨的夜空  阅读(191)  评论(0编辑  收藏  举报