首页  >  问答  >  正文

显示选项时修改 matSelect 样式

当选项打开时如何更改 mat-select 的属性?

<mat-select class="selector">
     <mat-option><mat-option>
</mat-select>

.selector:focus {
   color: green;
}

我尝试使用焦点,但效果不太好,可以单击垫选择而不打开选项。

解决方案:使用解决了问题

.mat-select[aria-expanded="true"] { 
    color: green 
}

P粉449281068P粉449281068177 天前1386

全部回复(1)我来回复

  • P粉729518806

    P粉7295188062024-04-06 00:19:04

    我使用 .mat-select[aria-expanded="true"] { color: green } 解决了这个问题

    回复
    0
  • 取消回复