簡體   English   中英

Angular 材料步進:僅顯示步進頭中的當前和下一步

[英]Angular Material Stepper: show only current and next step in stepper-header

我在水平方向和線性模式下使用Angular 材料步進器 (v13.xx)。

默認情況下,stepper-header 顯示所有可用的步驟。 但是我希望它只顯示活動步驟、之前的步驟和之后的步驟。 (當我觸發stepper.next()stepper.previous()時會發生這種轉變)。

以 2 作為活動步的當前情況: 在此處輸入圖像描述

以 2 作為活動步驟的通緝情況: 在此處輸入圖像描述

重要的是,所有 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM