<p-tree
[value]="files"
selectionMode="single"
(onNodeContextMenuSelect)="showContect($event)"
>
</p-tree>
当我右键单击时,此事件不起作用。相反,我得到了浏览器的默认上下文选项。
它应该调用
showContect
函数。
而不是
onNodeContextMenuSelect
,您应该使用添加 contextmenu
到 p-tree
组件
<p-tree
[value]="files"
selectionMode="single"
(contexmenu)="showContect($event); $event.preventDefault()"
>
</p-tree>
showContect(event){
console.log('called!')
}