不同的节点,右键的菜单显示内容不一样

如何控制不同的节点,右键的菜单显示不一样的内容呢?如下图:


比如z这个节点的右键菜单是三项,另一个节点右键菜单就是五项,或者其他。这样如何控制呢?…

Sorry, but I still cannot figure out what you are asking. Please use more words and small screenshots to describe what you want, both before and after events or actions, and how things should be different or the same for different nodes or links.

您好,就是不同的节点,右键菜单的内容不一样。现在好像只能都是统一的。


这样所有的右键菜单都是统一的,如何自定义右键菜单呢?

Use the normal ways of customizing the objects that are shown.

As demonstrated in https://gojs.net/latest/intro/contextmenus.html and in many of the samples such as https://gojs.net/latest/samples/basic.html, if you have a set of context menu buttons only some of which should apply to the specific node, you can use a Binding on each button’s visible property to hide or show each button.

Or you could bind the node’s contextMenu property to be of several predefined "ContextMenu"s that you set up once when you initialize your app.

Or you could do both.

Or you could implement whatever you want in HTML. Read more starting at https://gojs.net/latest/intro/contextmenus.html#HTMLContextMenus.