按下鼠标右键时需要实现上下文菜单。谷歌 Angular 项目。
<!-- Last Modified Column -->
<ng-container matColumnDef="modified">
<th mat-header-cell *matHeaderCellDef mat-sort-header>
<div align="left">По дате изменения</div>
</th>
<td mat-cell *matCellDef="let item" [matMenuTriggerFor]="contextmenu" (contextmenu)="openContext()"> {{item.modified.slice(0,10)}} я </td>
</ng-container>
openContext() {
this.triggerContext.openMenu();
}
按左键时菜单打开,但按右键时菜单不起作用!