vue中destroyed方法及使用示例讲解
作者:亲爱的阿乾
这篇文章主要为大家介绍了vue中destroyed方法及使用示例讲解,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪
正文
// 移除监听事件
destroyed() {
 window.removeEventListener('resize', this.resizeWin)
}// 移除对dom的操作
destroyed() {
 $("body").removeClass('maven-select');
}// 由于EventBus不会凭空消失,所以需要销毁EventBus相关定义的事件,否则一直会以指数型方式触发 $emit
destroyed() {
 bus.$off('get', this.myhandle)
}// 销毁VueX中存储的数据,否则页面不刷新,在页面刚渲染时,一直展示的是上次的数据
destroyed() {
 this.$store.dispatch("cleartList");
}// 清空浏览器localStorage种植的某些变量
destroyed() {
 window.localStorage.removeItem("ID");
}// 销毁定时器
destroyed() {
 clearInterval(this.timer);
 this.timer = null;
}// beforeDestroy 移除echarts的所有鼠标事件以及清空会话
beforeDestroy() {
 this.chartDom.off('click');
 this.chartDom.clear();
}以上就是vue中destroyed方法及使用示例讲解的详细内容,更多关于vue destroyed方法的资料请关注脚本之家其它相关文章!
