如何更改活动材料清单材料列表项角色组件的颜色?

时间:2018-02-27 09:58:01

标签: dart angular-dart angular-components dart-html dart-webui

enter image description here我正在尝试使用背景颜色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;
}

1 个答案:

答案 0 :(得分:1)

material-drawer material-list-item:hover, 
material-list-item:active,
material-list-item:visited {
  background-color: $mat-amber-A400; 
}