Просмотр исходного кода

fix(photography): 修复拍摄功能中事件监听器移除错误

- 将 '_re_take_picture' 替换为 '_digicam_take_picture',以匹配正确的事件名称
- 在组件卸载时移除 '_digicam_take_picture' 事件监听器,防止内存泄漏
panqiuyao 4 месяцев назад
Родитель
Сommit
1bbdf98e57
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      frontend/src/views/Photography/shot.vue

+ 3 - 1
frontend/src/views/Photography/shot.vue

@@ -564,7 +564,7 @@ const reTakePicture = async (img)=>{
         reNosObj.value.action = ''
         ElMessage.error(result.msg)
       }
-      clientStore.ipc.removeAllListeners(icpList.socket.message + '_re_take_picture');
+      clientStore.ipc.removeAllListeners(icpList.socket.message + '_digicam_take_picture');
 
     })
   }
@@ -817,6 +817,8 @@ onBeforeUnmount(() => {
   clientStore.ipc.removeAllListeners(icpList.socket.message + '_run_mcu_update');
   clientStore.ipc.removeAllListeners(icpList.socket.message + '_stop_action');
   clientStore.ipc.removeAllListeners(icpList.socket.message + '_run_mcu_stop');
+  clientStore.ipc.removeAllListeners(icpList.socket.message + '_digicam_take_picture');
+
 /*  window.removeEventListener('storage', handleStorageEvent);*/