Vue的生命周期vue实例从创建到销毁的过程 钩子函数:
- beforeCreate:vue实例创建之前,就是data数据还没有创建时
- created:vue实例创建完成时,可以拿到数据(一般用于发送axios请求)
- beforeMount:el或者$montd完成创建但data数据还未渲染时
- Mounted:data数据已经渲染到页面时()
- beforeUpdate:数据变化但还未更新渲染到页面时
- Updated:数据变化并更新渲染到页面时
- Beforedestroy:vue实例销毁前(一般用于清除定时器和全局事件)
- destroyed:完成销毁时