简体   繁体   English

如何为图标添加徽章

[英]How do I add a Badge to an Icon

I need to add a badge to the icon on my project that displays the count number values, i cant seem to make the badge work. 我需要在项目上的图标上添加一个徽章,显示计数值,我似乎无法使徽章工作。 Can anyone help me with this? 谁能帮我这个? and make the badge display the count value on the icon. 并使徽章在图标上显示计数值。

<div class="actions-bar" fxLayout="row" fxLayoutAlign="end center">
<label *ngIf="_dataSource.data.length > 0" class="mr-8">
<mat-icon class="mat-18 tick-icon">navigation</mat-icon>
<span>{{_dataSource.data.length}} locations</span>
</label>
<label *ngIf="_dataSource.data.length > 0" class="mr-8">
<mat-icon class="mat-18 warning-icon">warning</mat-icon>
<span>{{countWarningAddress()}} locations</span>
</label>
<label *ngIf="_dataSource.data.length > 0" class="mr-8">
<mat-icon matBadge="" matBadgeColor="accent" class="mat-18 tick- 
icon">check_circle</mat-icon>
<span>{{countValidAddress()}} locations</span>
</label>
<label *ngIf="_dataSource.data.length > 0" class="mr-8">
<mat-icon class="mat-18 flag-icon">flag</mat-icon>
<span>{{countInvalidAddress()}} locations</span>
</label>

If you are talking about hybrid mobile app badge then you can add plugin https://www.npmjs.com/package/cordova-plugin-badge for badge and use 如果您正在谈论混合移动应用程序徽章,那么您可以添加插件https://www.npmjs.com/package/cordova-plugin-badge用于徽章和使用

cordova.plugins.notification.badge.set(count); cordova.plugins.notification.badge.set(计数);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM