首頁  >  問答  >  主體

顯示選項時修改 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 天前1389

全部回覆(1)我來回復

  • P粉729518806

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

    我用 .mat-select[aria-expanded="true"] { color: green } 解決了這個問題

    回覆
    0
  • 取消回覆