您可以将垫子工具提示添加到垫子 table 列的 header 吗?

Can you add a mat tool tip to the header of a mat table column?

我希望能够添加一个工具提示,当鼠标悬停在 mat-table 中某列的 header 上时会显示该提示。 有没有办法做到这一点,因为当我添加垫子工具提示指示器时它不显示。

  <table mat-table [dataSource]="marketDataSource" matSort multiTemplateDataRows class="w-100">
    <!-- Status Status -->
    <ng-container matColumnDef="status">
      <th mat-header-cell *matHeaderCellDef mat-sort-header  matTooltip="Info about the action">
      Status
      </th>
      <td mat-cell *matCellDef="let element">
      <span>
        <mat-slide-toggle color="primary"></mat-slide-toggle>
      </span>
      </td>
    </ng-container>

    <tr mat-header-row *matHeaderRowDef="marketDisplayedColumns; sticky: true"></tr>
    <tr mat-row *matRowDef="let element; columns: marketDisplayedColumns;">
  </table>

在您的 component.ts

上导入 MatTooltip 模块
 import { MatTooltipModule } from '@angular/material/tooltip';