[英]Angular Material Stepper: show only current and next step in stepper-header
我在水平方向和線性模式下使用Angular 材料步進器 (v13.xx)。
默認情況下,stepper-header 顯示所有可用的步驟。 但是我希望它只顯示活動步驟、之前的步驟和之后的步驟。 (當我觸發stepper.next()
或stepper.previous()
時會發生這種轉變)。
重要的是,所有 5 個步驟都保持原樣工作。 我如何實現這一目標?
我在解決此問題時設法實現的最大目標是顯示當前和后續步驟。 這是 CSS 代碼:
::ng-deep {
// Hide inactive steps and their lines
.mat-step-header[aria-selected="false"],
.mat-step-header[aria-selected="false"] + .mat-stepper-horizontal-line {
visibility: collapse;
}
// Except for the next one
.mat-step-header[aria-selected="true"] + .mat-stepper-horizontal-line + .mat-step-header {
visibility: visible;
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.