I'm trying to display a "timeline" and I would like somting that look like this : enter image description here

对于不,我有以下几点:

enter image description here

使用:

<mat-stepper orientation="vertical" >
<div *ngFor="let step of steps; let i = index;">
    <mat-step [completed]="false" [editable]="false" state="number">
        <ng-template matStepLabel>
            Step {{i}}
        </ng-template>
    </mat-step>
</div>

有没有一种方法可以使用垫步进器只用于显示和阻止 Select ?

推荐答案

您可以使用定制的css和一些mat-Step配置来实现这一点

要添加到全局样式的CSS

.custom-stepper {
  .mat-vertical-content-container .mat-vertical-stepper-content {
    display: none;
  }

  .mat-step-icon {
    background-color: var(
      --mat-stepper-header-selected-state-icon-background-color
    );
    color: var(--mat-stepper-header-selected-state-icon-foreground-color);
  }
}

HTML

<mat-stepper
  orientation="vertical"
  [linear]="isLinear"
  #stepper
  class="custom-stepper"
>
  <div *ngFor="let step of steps; let i = index;">
    <mat-step [completed]="false" [editable]="true" state="number">
      <ng-template matStepLabel> Step {{i}} </ng-template>
    </mat-step>
  </div>
</mat-stepper>

stackblitz

Angular相关问答推荐

在Angular 17中加载页面时打开打印对话框

尾风手风琴中的Ngor

Rxjs重置执行后的可观察延迟并重新调度Angular

无效的ICU消息.缺少';}';|Angular material 拖放(&A)

NGNEW不会在src根文件夹ANGLI CLI 17.0.10中生成app.mode.ts

成Angular 的嵌套router-outlet

如何防止打印后的空格后的HTML元素的Angular ?

对REST后端的Angular/Priming过滤器请求导致无限循环

在Angular中扩展多个类

执行ng generate environments时出错时需要合集和原理图

在 Angular 14 中找不到命名空间google

Renderer2.appendChild 没有按预期工作?

Angular combinelatest使用没有初始值的主题

运行 npm 测试(Angular 2 单元测试)后无法读取未定义的属性 subscribe

类型错误:无法读取未定义的属性

CORS 错误:requests are only supported for protocol schemes: http…等

Angular 5 手动导入语言环境

Angular 2+ ngModule 中导入/导出的作用

为什么用?模板绑定中的运算符?

如何处理Angular2中的查询参数