我正在尝试使用背景颜色material-list-items
显示material-list
$mat-amber-A400
,但点击任意material-list-item
时,它会将颜色更改为light-grey
。我该如何申请background-color
甚至在点击项目时也会$mat-amber-A400
颜色。
app_component.html
<material-list class="name-card" *ngFor="let item of names">
<material-list-item class="names">
<span class="first">{{item.first}}</span>
<span class="second">{{item.second}}</span>
<material-chips><material-chip class="my-theme" [removable]="false"></material-chip>
<material-chip class="my-theme" [removable]="false"></material-chip>
</material-chips>
</material-list-item>
</material-list>
app_component.scss
material-list material-list-item {
display: flex;
flex-direction: column;
}
material-list material-list-item:hover, material-list-item:active, material-list-item:visited {
background-color: $mat-amber-A400;
}
.name-card {
background-color: $mat-amber-A400;
border-radius: 2px;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
margin: 16px;
display: inline-flex;
}
答案 0 :(得分:1)
material-drawer material-list-item:hover,
material-list-item:active,
material-list-item:visited {
background-color: $mat-amber-A400;
}