Skip to content

Commit b19b604

Browse files
committed
refactor: 代码优化
1 parent c84d84c commit b19b604

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

src/app/pages/login/login-form/login-form.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export class LoginFormComponent implements OnInit {
8686
源码地址:<a href="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/huajian123/ng-ant-admin">在这里</a>
8787
`,
8888
{
89+
nzPlacement: 'top',
8990
nzDuration: 0
9091
}
9192
);

src/app/pages/page-demo/task/task-list-panel/task-list-panel.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<nz-card [nzBodyStyle]="{ padding: 0 }">
22
<nz-collapse nzGhost>
33
<nz-collapse-panel *ngFor="let panel of panels" [nzActive]="panel.active" [nzDisabled]="panel.disabled" [nzExtra]="extraTpl" [nzHeader]="panel.name">
4-
<p style="margin: 0">A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
4+
<p style="margin: 0">我还在紧张开发中。。。嘻嘻</p>
55
</nz-collapse-panel>
66
</nz-collapse>
77
</nz-card>

src/app/shared/biz-components/icon-sel/icon-sel.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
nzTheme="outline"
77
[nzPopoverContent]="contentTemplate"
88
[nzPopoverTitle]="searchTitle"
9-
[nzType]="seletedIcon || 'appstore'"
9+
[nzType]="selectedIcon || 'appstore'"
1010
[(nzPopoverVisible)]="visible"
1111
></i>
1212
<ng-template #searchTitle>

src/app/shared/biz-components/icon-sel/icon-sel.component.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class IconSelComponent implements OnInit, AfterViewInit {
3030
@Input({ transform: booleanAttribute }) visible = false;
3131
// 做图标搜索防抖
3232
private searchText$ = new Subject<string>();
33-
seletedIcon = '';
33+
selectedIcon = '';
3434
@Output() readonly selIcon = new EventEmitter<string>();
3535
// 分页信息
3636
pageObj = {
@@ -58,11 +58,10 @@ export class IconSelComponent implements OnInit, AfterViewInit {
5858
}
5959

6060
selIconFn(item: IconItem): void {
61-
this.seletedIcon = item.icon;
62-
this.sourceIconsArray.forEach(icon => (icon.isChecked = false));
63-
this.iconsStrShowArray.forEach(icon => (icon.isChecked = false));
64-
this.iconsStrAllArray.forEach(icon => (icon.isChecked = false));
65-
61+
this.selectedIcon = item.icon;
62+
[this.sourceIconsArray, this.iconsStrShowArray, this.iconsStrAllArray].forEach(item => {
63+
item.forEach(icon => (icon.isChecked = false));
64+
});
6665
item.isChecked = true;
6766
this.selIcon.emit(item.icon);
6867
}

src/app/shared/biz-components/password-strength-meter/psm-progress-bar.directive.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ export class PSMProgressBarDirective implements OnChanges {
3131
this.progressBar = this.el.nativeElement;
3232
}
3333

34-
ngOnChanges(changes: SimpleChanges) {
34+
ngOnChanges(changes: SimpleChanges): void {
3535
if (changes['numberOfProgressBarItems']) {
3636
this.setProgressBarItems();
3737
}
3838

3939
this.setProgressBar();
4040
}
4141

42-
setProgressBarItems() {
42+
setProgressBarItems(): void {
4343
const progressBarItemContainer = this.progressBar.querySelector('.psm__progress-bar-items');
4444
const width = 100 / this.numberOfProgressBarItems!;
4545

@@ -57,7 +57,7 @@ export class PSMProgressBarDirective implements OnChanges {
5757
});
5858
}
5959

60-
setProgressBar() {
60+
setProgressBar(): void {
6161
const progressBarOverlayWidth = this.getFillMeterWidth(this.passwordStrength as number);
6262
const progressBarOverlayWidthInPx = `${progressBarOverlayWidth}%`;
6363

@@ -87,7 +87,7 @@ export class PSMProgressBarDirective implements OnChanges {
8787
return roundedStrengthInPercentage;
8888
}
8989

90-
getMeterFillColor(progressLevel: number) {
90+
getMeterFillColor(progressLevel: number): string {
9191
if (!progressLevel || progressLevel <= 0 || (progressLevel > this.colors.length && progressLevel > this.defaultColors.length)) {
9292
return this.colors[0] ? this.colors[0] : this.defaultColors[0];
9393
}

0 commit comments

Comments
 (0)