常用的生命周期函数: 时间节点
<script>
export default {
name: "演示路由router调用",
beforeCreate() {
console.log("创建之前");
},
create() {
console.log("创建完成");
},
beforeMount() {
console.log("挂载之前");
},
mounted() {
console.log("挂载之后");
},
beforeUpdate() {
console.log("更新之前");
},
update() {
console.log("更新之后");
},
beforeDestroy() {
console.log("销毁之前");
},
destroyed() {
console.log("销毁之后");
}
</script>
<script>
export default {
methods:{//定义方法的
add:function(){
this.counter++;
console.log("执行了add",this.bb);
},
jian:function(){
this.counter--;
console.log("执行了jian");
}
}
zidinyihanshu:function(){
console.log('自定义函数');
},
beforeCreate:function(){
console.log("常用的生命周期函数");
},
mounted:function(){
console.log("常用的生命周期函数");
}
})
}
</script>