antvis/G6


The issue has been closed
Custom ContextMenu (Submenu) #5795
RackweLLizm posted onGitHub
问题描述
Can we create submenu, that is, children, using the contextmenu plugin?
{
type: 'contextmenu',
trigger: 'contextmenu', // 'click' or 'contextmenu'
onClick: (v) => {
alert('You have clicked the「' + v + '」item');
},
getItems: () => {
return [
{ name: 'Option 1', value: 'option1' },
{
name: 'Option 2',
value: 'option2',
children: [
{ name: 'Sub Option 1', value: 'suboption1' },
{ name: 'Sub Option 2', value: 'suboption2' }
]
},
{ name: 'Option 3', value: 'option3' }
];
},
enable: (e) => e.targetType === 'node',
},
like in the example above.
Or can I integrate a menu I created myself into Antv G6 v5?
I could previously do this in Graphin via the library below.
import { ContextMenu } from '@antv/graphin-components';
<ContextMenu bindType="node"
>
<Menu
options={optionsNode.map(item => {
return { ...item, name: `${item.name}` };
})}
onChange={handleChangeNodeGraphinMenu}
bindType="node"
/>
</ContextMenu>
Any help is appreciated. Thanks
重现链接
notFound
重现步骤
notFound
预期行为
NotFound
平台
Windows Chrome 124 "@antv/g6": "^5.0.0-beta.37",
屏幕截图或视频(可选)
No response
补充说明(可选)
No response