diff --git a/AutoRobot/Windows/Robot/Web/src/DockLayout/Area.vue b/AutoRobot/Windows/Robot/Web/src/DockLayout/Area.vue index 32a3b0a..f4b18d2 100644 --- a/AutoRobot/Windows/Robot/Web/src/DockLayout/Area.vue +++ b/AutoRobot/Windows/Robot/Web/src/DockLayout/Area.vue @@ -147,6 +147,9 @@ const props = defineProps({ } }) +// 组件卸载标记 +const isUnmounted = ref(false) + // 使用全局事件总线和拖拽管理器 // 本地状态 @@ -446,6 +449,14 @@ const onDragStart = (e) => { // 添加鼠标移动和释放事件监听器 const handleMouseMove = (moveEvent) => { + // 检查组件是否已卸载 + if (isUnmounted.value) { + // 组件已卸载,清理事件监听器 + document.removeEventListener('mousemove', handleMouseMove) + document.removeEventListener('mouseup', handleMouseUp) + return + } + // 计算移动距离 const deltaX = moveEvent.clientX - dragStartPos.value.x const deltaY = moveEvent.clientY - dragStartPos.value.y @@ -901,6 +912,9 @@ onMounted(() => { // 组件卸载时清理状态 onUnmounted(() => { + // 设置组件卸载标记 + isUnmounted.value = true + // 清理拖拽和调整大小状态 isDragging.value = false currentDragId.value = null diff --git a/AutoRobot/Windows/Robot/Web/src/DockLayout/DockIndicator.vue b/AutoRobot/Windows/Robot/Web/src/DockLayout/DockIndicator.vue index 5d536e1..2fc380d 100644 --- a/AutoRobot/Windows/Robot/Web/src/DockLayout/DockIndicator.vue +++ b/AutoRobot/Windows/Robot/Web/src/DockLayout/DockIndicator.vue @@ -70,8 +70,8 @@
+
@zone-active="onDockZoneActive" style="z-index: 9999;" - /> + >
@@ -46,24 +48,21 @@