angular - 如何在 Angular 材质中制作悬挂效果?
问题描述
我有一个组件mat-list-item
。悬停在其上时如何使悬停效果出现。
<mat-list-item style="cursor:pointer" *ngFor="let sprWellplatform of sprWellplatforms" (click)="onSelectSprWellplatform(sprWellplatform)">
<h4 mat-line>{{sprWellplatform.name}}</h4>
<mat-divider></mat-divider>
</mat-list-item>
解决方案
方法:
您可以直接使用 csshover
让悬停在项目上工作。
类由 Angularmat-list-item
添加到您的mat-list-item
标签中。
因此,在此类上应用“悬停”,如下所示:
.mat-list-item:hover {
background: rgba(0,0,0,.54);
cursor: pointer;
}
带有正确代码的演示: https ://stackblitz.com/edit/angular-jewgan?file=src%2Fapp%2Fapp.component.html
请评论,如果没有帮助。
推荐阅读
- c# - c# 从动态对象(已从 JSON 字符串转换)转换回 DataTable
- php - 自动回复不适用于使用 php mail() 的 gmail 帐户
- python - 如何使用 blit 有效地重绘多个 matplotlib 图
- python - 识别特定字符串并将其放在同一索引中
- java - 为什么 hadoop fs 命令不能执行来创建目录?
- azure - Microsoft 通过加载每个模块来学习我收到此错误:“检测到未经授权的沙箱使用。您的沙箱已被终止。”
- java - Android Studio 中的 Listview 与 TableView
- javascript - 如何动态改变新窗口的大小?
- sql - HAVING 和 WHERE SQL
- maven - 在我为我的空手道项目运行 mvn clean install 命令后,黄瓜报告停止生成