1 beforeCreate(创建前)
2 created(创建后)
3 beforeMount(载入前)
4 mounted(载入后)
5 beforeUpdate(更新前)
6 updated(更新后)
7 beforeDestroy(销毁前)
8 destroyed(销毁后)
Vue第一次页面加载会触发beforeCreate created beforeMount mounted四个钩子函数
DOM渲染在mounted这个周期就已经完成
beforeCreate this.$el 和this.$data 都是 undefined
created this.$el 没有 this.$data 有
beforeMount this.$el 没有 this.$data 有
mounted this.$el 和this.$data 都能获取到
如果 增加了keep-alive组件会新增两个生命周期
activetd
teactivetd