feat: 在机器人组和标签组件中添加禁用右键菜单功能,优化用户交互体验
This commit is contained in:
parent
b266180e45
commit
86489c326c
@ -17,6 +17,7 @@ type Props = {
|
||||
showGroupEdit?: boolean;
|
||||
editable?: boolean;
|
||||
current?: string;
|
||||
disableContextMenu?: boolean;
|
||||
};
|
||||
const props = defineProps<Props>();
|
||||
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);
|
||||
|
@ -17,6 +17,7 @@ type Props = {
|
||||
showLabelEdit?: boolean;
|
||||
editable?: boolean;
|
||||
current?: string;
|
||||
disableContextMenu?: boolean;
|
||||
};
|
||||
const props = defineProps<Props>();
|
||||
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);
|
||||
|
@ -354,6 +354,7 @@ const handleAutoCreateStorageCancel = () => {
|
||||
:current="current?.id"
|
||||
@change="selectRobot"
|
||||
show-group-edit
|
||||
:disable-context-menu="true"
|
||||
/>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="1.5" :tab="$t('机器人标签')">
|
||||
@ -364,6 +365,7 @@ const handleAutoCreateStorageCancel = () => {
|
||||
:editable="editable"
|
||||
:current="current?.id"
|
||||
@change="selectRobot"
|
||||
:disable-context-menu="true"
|
||||
/>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" :tab="$t('库位')">
|
||||
|
Loading…
x
Reference in New Issue
Block a user