antvis/G6

【V5】Contextmenu插件点击菜单无响应 #5769

zhouyuyong posted onGitHub

Describe the bug

image 如图点击菜单项无反应

本地开发环境一样点击菜单项无反应

Your Example Website or App

https://g6-next.antv.antgroup.com/api/plugins/contextmenu

Steps to Reproduce the Bug or Issue

{
  type: 'contextmenu',
  trigger: 'contextmenu', // 'click' or 'contextmenu'
  onClick: (v) => {
    alert('You have clicked the「' + v + '」item');
  },
  getItems: () => {
    return [
      { name: '展开一度关系', value: 'spread' },
      { name: '查看详情', value: 'detail' },
    ];
  },
  enable: (e) => e.targetType === 'node',
},

Expected behavior

修复此问题

Screenshots or Videos

No response

Platform

  • OS: [ macOS]
  • Browser: [Chrome]
  • Version: [5.0.37]

Additional context

No response


image 在画布上点击也能显示菜单

https://g6-next.antv.antgroup.com/examples/plugin/contextMenu/#basic 这个示例正常

posted by zhouyuyong 11 months ago

image 本地意识这样,且点击菜单项无任何响应,控制台也未报错

posted by zhouyuyong 11 months ago

image 在画布上点击也能显示菜单

https://g6-next.antv.antgroup.com/examples/plugin/contextMenu/#basic 这个示例正常

在画布上点击也出来菜单的问题是因为调试时把enable设置为true了,这个问题忽略

posted by zhouyuyong 11 months ago

你好,该问题会尽快修复

posted by Aarebecca 11 months ago

补充:此问题是在vue3中发生的,经过反复试验发现在布局组件中添加了事件修饰符.stop ,导致click事件无法传递到g6,目前将.stop事件修饰符去掉问题解决

posted by zhouyuyong 10 months ago

Fund this Issue

$0.00
Funded

Pull requests