我在屏幕上填充了一个元素列表,只想在 ListView 中突出显示所选元素,请帮忙
<ion-list >
<button ion-item *ngFor="let route of Routes" (click)="selectCP(route)" >
{{route.Name}}
</button>
</ion-list>
最佳答案
使用 Angular 条件样式函数。
[class.stylename]="一些将返回 true 或 false 的条件语句"
例子:
<!-- This will probably go into your SCSS stylesheet -->
<style>
.highlight {
background-color: #FFFF33 !important;
}
</style>
<!-- In your HTML code -->
<ion-list >
<button ion-item [class.highlight]="route == 1" *ngFor="let route of Routes" (click)="selectCP(route)" >
{{route.Name}}
</button>
</ion-list>
https://stackoverflow.com/questions/50632982/
相关文章:
python - 遍历列表,比较值并删除重复项 - Python
xamarin - 类型 'StackLayout' 的值不能添加到类型 'IList' 的集合或字
javascript - 如何从url获取json数据并保存到const变量【TypeScript】
python-3.x - 如何在不更改 css 的情况下共享 pytest-html 的 html
qt - 没有安装 qmlscene : why is a warning sign next to
php - 如何显示在 php 中使用 file_get_contents 检索到的 pdf?
r - 重新启动的组计数器(使用 R data.table)
powershell - 在 PowerShell 中比较字符串中的日期