自定义垫式日历标题

问题描述 投票:0回答:2

我期待垫式日历标题为自定义标题,如下面的屏幕截图所示

angular angular-material calendar
2个回答
4
投票

它只是创建一个自定义标题,如文档的示例

您可以与垫式日历一起使用

  <mat-calendar [headerComponent]="exampleHeader" [(selected)]="date">
  </mat-calendar>

请参阅示例的分叉 stackblitz 此处


0
投票

上面的 stackblitz 没有显示如何正确设置日历标题的格式。如果您希望标题以“MMMM YYYY”格式显示。将 periodLabel() 更改为以下内容:

  get periodLabel() {
    return this._dateAdapter.format(this._calendar.activeDate, this._dateFormats.display.monthYearA11yLabel);
  }
© www.soinside.com 2019 - 2024. All rights reserved.