浏览代码

5.5版本首页-清除定时器提交

lxh 1 年之前
父节点
当前提交
88d85b747a
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/views/vent/home/colliery/index.vue

+ 6 - 2
src/views/vent/home/colliery/index.vue

@@ -78,7 +78,7 @@
   </div>
 </template>
 <script lang="ts" setup>
-import { reactive, onMounted, ref, nextTick, computed } from 'vue';
+import { reactive, onMounted, ref, nextTick, computed, onUnmounted,onBeforeUnmount } from 'vue';
 import fanMonitor from './components/fan-monitor.vue';
 import mainMonitor from './components/main-monitor.vue';
 import windDevice from './components/wind-device.vue';
@@ -265,6 +265,9 @@ onMounted(() => {
     }, 10000)
   );
 });
+onBeforeUnmount(() => {
+  clearInterval(timer);
+});
 </script>
 
 <style lang="less" scoped>
@@ -492,4 +495,5 @@ onMounted(() => {
 // #__qiankun_microapp_wrapper_for_micro_vent_3_d_modal__{
 //   width: 100% !important;
 //   height: 100% !important;
-// }</style>
+// }
+</style>