-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module:rate): support customize character (#6787)
- Loading branch information
1 parent
d1cdd0e
commit 7163e36
Showing
5 changed files
with
97 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
order: 6 | ||
title: | ||
zh-CN: 自定义字符 | ||
en-US: Customize Character | ||
--- | ||
|
||
## zh-CN | ||
|
||
可以通过索引自定义每一个字符。 | ||
|
||
## en-US | ||
|
||
Each character can be customized by index. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-rate-customize', | ||
template: ` | ||
<nz-rate [ngModel]="2" [nzCharacter]="characterNumber"></nz-rate> | ||
<br /> | ||
<nz-rate [ngModel]="3" [nzCharacter]="characterIcon"></nz-rate> | ||
<br /> | ||
<ng-template #characterNumber let-index> | ||
{{ index + 1 }} | ||
</ng-template> | ||
<ng-template #characterIcon let-index> | ||
<ng-container [ngSwitch]="index"> | ||
<i nz-icon nzType="frown" *ngSwitchCase="0"></i> | ||
<i nz-icon nzType="frown" *ngSwitchCase="1"></i> | ||
<i nz-icon nzType="meh" *ngSwitchCase="2"></i> | ||
<i nz-icon nzType="smile" *ngSwitchCase="3"></i> | ||
<i nz-icon nzType="smile" *ngSwitchCase="4"></i> | ||
</ng-container> | ||
</ng-template> | ||
`, | ||
styles: [ | ||
` | ||
.large ::ng-deep .ant-rate-star { | ||
font-size: 36px; | ||
} | ||
` | ||
] | ||
}) | ||
export class NzDemoRateCustomizeComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters