-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
change.ts
59 lines (54 loc) · 1.17 KB
/
change.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { Component } from '@angular/core';
@Component({
selector: 'nz-demo-badge-change',
template: `
<div>
<nz-badge [nzCount]="count">
<a class="head-example"></a>
</nz-badge>
<nz-button-group>
<button nz-button (click)="minCount()"><span nz-icon nzType="minus"></span></button>
<button nz-button (click)="addCount()"><span nz-icon nzType="plus"></span></button>
</nz-button-group>
</div>
<br />
<div>
<nz-badge [nzDot]="dot">
<a class="head-example"></a>
</nz-badge>
<nz-switch [(ngModel)]="dot"></nz-switch>
</div>
`,
styles: [
`
nz-badge {
margin-right: 20px;
}
nz-badge.ant-badge-rtl {
margin-right: 0;
margin-left: 20px;
}
.head-example {
width: 42px;
height: 42px;
border-radius: 4px;
background: #eee;
display: inline-block;
vertical-align: middle;
}
`
]
})
export class NzDemoBadgeChangeComponent {
count = 5;
dot = true;
addCount(): void {
this.count++;
}
minCount(): void {
this.count--;
if (this.count < 0) {
this.count = 0;
}
}
}