通过使用primeng,当我右键单击树节点时,Contextmenu不会打开。 初始代码:-
<p-tree [value]="coaList" selectionMode="single" [(selection)]="coa" [contextMenu]="cm" (onNodeSelect)="nodeSelect($event)"></p-tree>
<p-contextMenu #cm [model]="items"></p-contextMenu>
和component.ts
中this.items = [
{ label: 'View', icon: 'fa fa-search', command: (event) => this.viewFile(this.coa) },
{ label: 'Unselect', icon: 'fa fa-close', command: (event) => this.viewFile(this.coa) }
];
其中component.ts中的import是:-
import { TreeNode, MenuItem } from 'primeng/api';
和模块
import { ContextMenuModule } from primeng/components/contextmenu/contextmenu';
我在做什么错?