onNodeContextMenuSelect 在 p 树中不起作用

问题描述 投票:0回答:1
<p-tree
  [value]="files"
  selectionMode="single"
  (onNodeContextMenuSelect)="showContect($event)"
>
</p-tree>

当我右键单击时,此事件不起作用。相反,我得到了浏览器的默认上下文选项。

它应该调用

showContect
函数。

angular typescript primeng
1个回答
0
投票

而不是

onNodeContextMenuSelect
,您应该使用添加
contextmenu
p-tree
组件

 <p-tree
  [value]="files"
  selectionMode="single"
  (contexmenu)="showContect($event); $event.preventDefault()"
>
</p-tree>
showContect(event){
 console.log('called!')
}
© www.soinside.com 2019 - 2024. All rights reserved.