From e879a24afee877a7308dab476cdccbbd880156a5 Mon Sep 17 00:00:00 2001 From: zqm Date: Tue, 20 Jan 2026 09:27:36 +0800 Subject: [PATCH] =?UTF-8?q?Area=E6=8B=96=E6=8B=BD=E6=8C=87=E7=A4=BA?= =?UTF-8?q?=E5=99=A8=E4=BC=98=E5=8C=96=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Windows/Robot/Web/src/DockLayout/Area.vue | 14 + .../Web/src/DockLayout/DockIndicator.vue | 339 +++++++++++++++--- .../Robot/Web/src/DockLayout/DockLayout.vue | 208 +++++++++-- .../src/DockLayout/handlers/AreaHandler.js | 161 +++++++++ 4 files changed, 637 insertions(+), 85 deletions(-) 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 @@