From d88d194f518cdec2ba195e58996561604b1a6a96 Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Fri, 20 Dec 2019 17:22:23 +0300 Subject: [PATCH] Fixed #118 - ContextMenu fails in global mode --- src/components/contextmenu/ContextMenu.vue | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/components/contextmenu/ContextMenu.vue b/src/components/contextmenu/ContextMenu.vue index c322ad981..fd0a4a028 100644 --- a/src/components/contextmenu/ContextMenu.vue +++ b/src/components/contextmenu/ContextMenu.vue @@ -50,6 +50,11 @@ export default { this.unbindOutsideClickListener(); this.unbindDocumentContextMenuListener(); }, + mounted() { + if (this.global) { + this.bindDocumentContextMenuListener(); + } + }, methods: { itemClick(event) { const item = event.item; @@ -89,10 +94,6 @@ export default { this.bindOutsideClickListener(); this.bindResizeListener(); - if (this.global) { - this.bindDocumentContextMenuListener(); - } - if (this.autoZIndex) { this.$refs.container.style.zIndex = String(this.baseZIndex + DomHandler.generateZIndex()); } @@ -100,10 +101,6 @@ export default { onLeave() { this.unbindOutsideClickListener(); this.unbindResizeListener(); - - if (this.global) { - this.unbindDocumentContextMenuListener(); - } }, position() { let left = this.pageX + 1;