瀏覽代碼

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

FuryBean 7 年之前
父節點
當前提交
0c8523bce9
共有 1 個文件被更改,包括 4 次插入0 次删除
  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);
       },