我有以下组件设置
devis.component.ts
@Component({
selector: 'app-devis',
templateUrl: './devis.component.html',
styleUrls: ['./devis.component.scss']
})
export class DevisComponent implements OnInit { }
devis.component.html
<mat-horizontal-stepper>
<mat-step label="First step">
<div style="height: 100%">
content 1
</div>
</mat-step>
<mat-step label="Second step">
<div style="height: 100%;">
content 2
</div>
</mat-step>
<mat-step label="Last step">
<div id="content" style="height: 100%;">
content 3
</div>
</mat-step>
</mat-horizontal-stepper>
我希望步骤的内容是全高的,但在那之前,它不能。
所以我添加了以下 css 规则并将其设置viewEncapsulation
为None
.
devis.component.scss
mat-horizontal-stepper {
height: calc(100% - 5rem);
}
.mat-stepper-horizontal .mat-horizontal-content-container {
height: calc(100% - 72px) !important;
padding: 0 !important;
.mat-horizontal-stepper-content {
height: 100%;
}
}
然后第一步正确地获得了样式。但是当我移动到其他步骤时,什么都没有。
这mat-horizontal-stepper
是 100% 的高度,但它的内容甚至没有显示。在检查器中可以看到 #content 上的内联样式,但不应用包含它的所有内容。