Angular 将编号更改为带角度的双步进
我尝试将stepper打印到stepper中:Angular 将编号更改为带角度的双步进,angular,angular-material,stepper,Angular,Angular Material,Stepper,我尝试将stepper打印到stepper中: <mat-vertical-stepper> <mat-step *ngFor="let step of Steps" [label]="step.name"> <mat-vertical-stepper> <mat-step *ngFor="let substep of step.subnames" [label]="substep.subnam
<mat-vertical-stepper>
<mat-step *ngFor="let step of Steps" [label]="step.name">
<mat-vertical-stepper>
<mat-step *ngFor="let substep of step.subnames" [label]="substep.subname">
</mat-step>
</mat-vertical-stepper>
</mat-step>
</mat-vertical-stepper>
它可以工作,但我想更改数字表示:
改变
- 一,
- 一,
- 二,
- 二,
- 一,
- 二,
- 一,
- 1.1
- 1.2
- 二,
- 2.1
- 2.2
如何做到这一点,请?您可以在绑定表达式中使用javascript语法
<mat-step *ngFor="let substep of step.subnames" [label]="[step.name,substep.subname].join('.')">
</mat-step>
但它会降低大型菜单的性能,因为每次执行“脏检查”(如果不使用onPush策略)时都需要计算表达式
因此,考虑为菜单组件添加
changeDetection:ChangeDetectionStrategy.OnPush
,或者在使用之前预先计算完整的子菜单标签。您可以在绑定表达式中使用javascript语法
<mat-step *ngFor="let substep of step.subnames" [label]="[step.name,substep.subname].join('.')">
</mat-step>
但它会降低大型菜单的性能,因为每次执行“脏检查”(如果不使用onPush策略)时都需要计算表达式
因此,考虑添加
changeDetection:ChangeDetectionStrategy.on为菜单组件推送,或在使用前预先设定完整的子菜单标签。尝试以下操作:
style.css:
.mat-vertical-stepper-header .mat-step-icon, .mat-vertical-stepper-header .mat-step-icon-not-touched {
font-size: 0px;
margin-left: 10px;
background-color: black;
height: 5px;
width: 5px;
}
.mat-vertical-stepper-header .mat-step-icon, .mat-vertical-stepper-header .mat-step-icon-touched {
font-size: 0px;
margin-left: 10px;
background-color: black;
height: 5px;
width: 5px;
}
mat-step-header[ng-reflect-selected="true"] .mat-step-icon{
font-size: 12px;
align-self: center;
color: white;
height: 20px;
width: 20px;
}
mat-step-header[ng-reflect-selected="false"] .mat-step-icon .mat-icon{
display: none
}
HTML:
尝试以下方法:
style.css:
.mat-vertical-stepper-header .mat-step-icon, .mat-vertical-stepper-header .mat-step-icon-not-touched {
font-size: 0px;
margin-left: 10px;
background-color: black;
height: 5px;
width: 5px;
}
.mat-vertical-stepper-header .mat-step-icon, .mat-vertical-stepper-header .mat-step-icon-touched {
font-size: 0px;
margin-left: 10px;
background-color: black;
height: 5px;
width: 5px;
}
mat-step-header[ng-reflect-selected="true"] .mat-step-icon{
font-size: 12px;
align-self: center;
color: white;
height: 20px;
width: 20px;
}
mat-step-header[ng-reflect-selected="false"] .mat-step-icon .mat-icon{
display: none
}
HTML:
谢谢,它起作用了,有可能把数字放进泡泡里吗?谢谢,它起作用了,有可能把数字放进泡泡里吗?谢谢,它也起作用了,有可能把索引号放进泡泡里吗?谢谢,但似乎索引号不在泡泡里,也许不可能?你也想要数字吗??你帮了我很多,我也学到了很多:)如果你来巴黎,我会请你喝一杯谢谢你的补充。我会让你知道是否会在那里。谢谢,它也起作用,有可能把索引号放入气泡中吗?谢谢,但似乎索引号不在气泡中,也许不可能?你也想要数字吗??你帮了我很多,我也学到了很多:)如果你来巴黎,我会请你喝一杯谢谢你的补充。我会让你知道我是否会在那里。