diff --git a/src/components/robot-groups.vue b/src/components/robot-groups.vue index 8efbf8a..88d2916 100644 --- a/src/components/robot-groups.vue +++ b/src/components/robot-groups.vue @@ -17,6 +17,7 @@ type Props = { showGroupEdit?: boolean; editable?: boolean; current?: string; + disableContextMenu?: boolean; }; const props = defineProps(); const editor = inject(props.token)!; @@ -87,6 +88,10 @@ const selectRobot = (id: RobotInfo['id'], checked: boolean) => { // 处理机器人右键点击 const handleRobotRightClick = (event: MouseEvent, robot: RobotInfo) => { + if (props.disableContextMenu) { + event.preventDefault(); + return; + } // 为事件目标添加机器人标识 if (event.target && event.target instanceof HTMLElement) { event.target.setAttribute('data-robot-id', robot.id); diff --git a/src/components/robot-labels.vue b/src/components/robot-labels.vue index 423dd18..7452197 100644 --- a/src/components/robot-labels.vue +++ b/src/components/robot-labels.vue @@ -17,6 +17,7 @@ type Props = { showLabelEdit?: boolean; editable?: boolean; current?: string; + disableContextMenu?: boolean; }; const props = defineProps(); const editor = inject(props.token)!; @@ -86,6 +87,10 @@ const selectRobot = (id: RobotInfo['id'], checked: boolean) => { // 处理机器人右键点击 const handleRobotRightClick = (event: MouseEvent, robot: RobotInfo) => { + if (props.disableContextMenu) { + event.preventDefault(); + return; + } // 为事件目标添加机器人标识 if (event.target && event.target instanceof HTMLElement) { event.target.setAttribute('data-robot-id', robot.id); diff --git a/src/pages/scene-editor.vue b/src/pages/scene-editor.vue index 7643718..84e4ecc 100644 --- a/src/pages/scene-editor.vue +++ b/src/pages/scene-editor.vue @@ -354,6 +354,7 @@ const handleAutoCreateStorageCancel = () => { :current="current?.id" @change="selectRobot" show-group-edit + :disable-context-menu="true" /> @@ -364,6 +365,7 @@ const handleAutoCreateStorageCancel = () => { :editable="editable" :current="current?.id" @change="selectRobot" + :disable-context-menu="true" />