移除监听事件
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();
}