beforeDestroy(实例销毁前)
- 类型:Function
- 详细: 实例销毁之前调用 , 实例仍然完全可用。
- 使用场景: 主要解绑一些使用addEventListener监听的事件或者定时器
beforeDestroy() {
this.stopTrack();
},
beforeDestroy() {
this.data.length = 0;
this.data1.length = 0;
},
beforeDestroy() {
this.adasFiles = [];
this.adasFilesRec = [];
},
beforeDestroy() {
document.removeEventListener('keydown', this

本文介绍了Vue.js中beforeDestroy和destroyed两个生命周期钩子函数。beforeDestroy在实例销毁前调用,此时实例仍然完全可用,常用于解绑事件和清理定时器。destroyed则在实例被销毁后调用,此时所有指令已被解绑,事件监听器移除,子实例也被销毁,适合做最后的清理工作,如显示提示信息。
最低0.47元/天 解锁文章
934

被折叠的 条评论
为什么被折叠?



