mirror of
https://gitee.com/antv/g6.git
synced 2024-12-02 03:38:20 +08:00
fix: fix click connot trigger context menu (#6007)
This commit is contained in:
parent
8180e576b4
commit
d8bf0e054c
@ -213,13 +213,15 @@ export class Contextmenu extends BasePlugin<ContextmenuOptions> {
|
||||
};
|
||||
|
||||
private onMenuItemClick = (event: MouseEvent) => {
|
||||
const { onClick } = this.options;
|
||||
const { onClick, trigger } = this.options;
|
||||
if (event.target instanceof HTMLElement) {
|
||||
if (event.target.className.includes('g6-contextmenu-li')) {
|
||||
const value = event.target.getAttribute('value') as string;
|
||||
onClick?.(value, event.target);
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
this.hide();
|
||||
|
||||
if (trigger !== 'click') this.hide();
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user