|
|
@@ -25,7 +25,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
-import { onMounted, ref } from 'vue';
|
|
|
+import { onMounted, onUnmounted, ref } from 'vue'; // [perf-base-v1] 补 onUnmounted 用于清理轮询
|
|
|
import BasicMonitoring from '/@/components/vent/BasicMonitoring.vue';
|
|
|
import { useInitConfigs, useInitPage } from '../../home/configurable/hooks/useInit';
|
|
|
import { nitrogenConfigs } from './nitrogen.data';
|
|
|
@@ -53,8 +53,10 @@ async function getDataSource() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// [perf-base-v1] 轮询句柄,卸载时清理,修复裸 setInterval 泄漏
|
|
|
+let interval: number | undefined;
|
|
|
function initInterval() {
|
|
|
- setInterval(() => {
|
|
|
+ interval = setInterval(() => {
|
|
|
refresh();
|
|
|
}, 60000);
|
|
|
}
|
|
|
@@ -62,6 +64,9 @@ onMounted(() => {
|
|
|
refresh();
|
|
|
initInterval();
|
|
|
});
|
|
|
+onUnmounted(() => {
|
|
|
+ clearInterval(interval);
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|