vue生命周期 钩子函数

beforeCreate:初始化之前

beforeCreate(){
console.log("代码初始化之前")
}

Created:初始化完成

created(){
console.log("初始化完成");
}

beforeMount:挂载之前

beforeMount(){
console.log("挂载之前")
}

mounted:挂载之后

mounted(){
console.log("挂载之后")
}

beforeUpdate:数据更新之前

beforeUpdate(){
console.log("数据更新之前")
}

updated:数据更新之后

updated(){
console.log("更新之后")
}

beforeDestroy:解除绑定之前

beforeDestroy(){
console.log("解除绑定之前")
}

destroyed:解除绑定之后

destroyed(){
console.log("解除绑定之后")
}

解除绑定需要在vue实例之外写解除绑定的方法  vue自己定义好了" $destroy

function del(){
app.$destroy()
}

vue生命周期图示:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值