效果图
html
<div style="width: 20px;height: 20px;margin-top: 15px;margin-right: 20px;float: left">
<a style="cursor:pointer;text-decoration:none;" onclick="goEventAlarm()" >
<div *ngIf="eveneAlarmSize>0&&eveneAlarmSize<99" class="nav-counter nav-counter-blue" >{{eveneAlarmSize}}</div>
<div *ngIf="eveneAlarmSize>99" class="nav-counter nav-counter-blue" >99+</div>
<img src="assets/images/gaojing3.png" style="width: 100%;height: 100%;" >
</a>
</div>
数字图标样式
/*购物车角标数字*/
.nav-counter {
position: relative;
top: 11px;
right: -8px;
min-width: 8px;
height: 15px;
width: 15px;
line-height: 15px;
margin-top: -8px;
font-weight: normal;
color: white;
text-align: center;
text-shadow: 0 1px rgb(0 0 0 / 20%);
background: #e23442;
border: 1px solid #911f28;
border-radius: 10px;
background-image: -moz-linear-gradient(top, #e8616c, #dd202f);
background-image: -o-linear-gradient(top, #e8616c, #dd202f);
background-image: linear-gradient(to bottom, #e8616c, #dd202f);
-webkit-box-shadow: inset 0 0 1px 1px rgb(255 255 255 / 10%), 0 1px rgb(0 0 0 / 12%);
box-shadow: inset 0 0 1px 1px rgb(255 255 255 / 10%), 0 1px rgb(0 0 0 / 12%);
}
.nav-counter-blue {
background: #e8616c;
border: 1px solid #dd202f;
background-image: -webkit-linear-gradient(top, #e8616c, #dd202f);
background-image: -moz-linear-gradient(top, #e8616c, #dd202f);
background-image: -o-linear-gradient(top, #e8616c, #dd202f);
background-image: linear-gradient(to bottom, #e8616c, #dd202f);
}
扩展内容
做了某些操作时更新条数
- 在页面添加刷新按钮 <button style=“display: none” id=“HeadEvent” (click)=“getEveneAlarm()”>
- 调用刷新事件 document.getElementById(‘HeadEvent’).click();