Browse Source

Tree: stopPropagation and preventDefault for node-contextmenu if bound (#10123)

FuryBean 7 năm trước cách đây
mục cha
commit
0c8523bce9
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      packages/tree/src/tree-node.vue

+ 4 - 0
packages/tree/src/tree-node.vue

@@ -165,6 +165,10 @@
       },
 
       handleContextMenu(event) {
+        if (this.tree._events['node-contextmenu'] && this.tree._events['node-contextmenu'].length > 0) {
+          event.stopPropagation();
+          event.preventDefault();
+        }
         this.tree.$emit('node-contextmenu', event, this.node.data, this.node, this);
       },