我有一个粘性表格,想要添加 更多按钮
来切换,但是我无法实现它,因为我不知道如何区分每个 下拉菜单列表
。
这张表格是来自REST API的用户数据列表,每行的菜单应该显示:
- 删除用户
- 编辑用户资料
当我点击 更多按钮
时。
我已经遵循了 Material Menus 和 Sticky Table 的文档,但每次我点击按钮在任意一行上显示下拉菜单时...
<ng-container matColumnDef="actions" stickyEnd>
<th mat-header-cell *matHeaderCellDef mat-sort-header> </th>
<td mat-cell *matCellDef="let user">
<button mat-icon-button [matMenuTriggerFor]="user.user_id" aria-label="">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #appMenu="user.user_id">
<button mat-menu-item>Delete</button>
<button mat-menu-item>Edit</button>
</mat-menu>
</td>
</ng-container>