Vue3中组件的生命周期函数
beforeCreate() {
console.log('实例刚刚被创建');
},
created() {
console.log('实例已经创建完成');
},
beforeMount() {
console.log('模板编译之前');
},
mounted() {
console.log('模板编译完成');
},
beforeUpdate() {
console.log('数据更新之前');
},
updated() {
console.log('数据更新完成');
},
activated() {
console.log('keep-alive 缓存的组件激活时调用');
},
deactivated() {
console.log('keep-alive 缓存的组件停用时调用');
},
beforeUnmount() {
console.log('实例销毁之间');
},
unmounted() {
console.log('实例销毁完成');
},