处理监听图表的函数,确保及时移除&生产环境不打印log
This commit is contained in:
@@ -154,6 +154,18 @@ export default {
|
||||
},
|
||||
// 未使用的蒸汽仪表盘可注释/删除
|
||||
// getSteamGaugeOption(value) { ... }
|
||||
},
|
||||
beforeDestroy() {
|
||||
// 销毁 ResizeObserver,避免内存泄漏
|
||||
if (this.resizeObserver) {
|
||||
this.resizeObserver.disconnect();
|
||||
this.resizeObserver = null;
|
||||
}
|
||||
// 销毁图表实例
|
||||
if (this.electricityChart) {
|
||||
this.electricityChart.dispose();
|
||||
this.electricityChart = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user