如何更改mat-table中行的高度

Ram*_*esh 5 css angular angular7 angular-material-7 mat-table

我正在尝试提升垫表中悬停的行,因此将<tr>悬停时的高度更改为悬停时的高度,但阴影效果的高度未显示在行的底部,但显示在行的顶部、左侧和右侧。

.html

<div class="mat-elevation-z2" #TABLE>
      <table mat-table [dataSource]="dataSource" matSort>

    <!-- Required Columns... -->

    <tr mat-header-row *matHeaderRowDef="columnsToDisplay"></tr>
        <tr mat-row *matRowDef="let row; let e = index; columns: columnsToDisplay;"
          (mouseover)="onMouseOver(e)" [ngClass] = "{'mat-elevation-z24' : e == mouseOverIndex}"></tr>
      </table>
    </div>
Run Code Online (Sandbox Code Playgroud)

.ts

 mouseOverIndex = -1;

public onMouseOver(index) {
    this.mouseOverIndex = index;
  }
Run Code Online (Sandbox Code Playgroud)

.css

.mat-row:hover {
  cursor: pointer;
}
Run Code Online (Sandbox Code Playgroud)

我在这里缺少什么?

我尝试使用“z24”、“z16”、“z8”等,但没有用。

Mar*_*hal 4

看起来background: inherit行上的 覆盖了底部的投影。

将以下内容添加到 CSS 将解决此问题。

[mat-row].remove-background {
  background: none ;
}
Run Code Online (Sandbox Code Playgroud)

然后将类应用到您的行。

<tr mat-row class="remove-background" (mouseover)="onMouseOver(e)"
Run Code Online (Sandbox Code Playgroud)

斯塔克闪电战

https://stackblitz.com/edit/angular-ecrvzg?embed=1&file=app/table-basic-example.css