我期待垫式日历标题为自定义标题,如下面的屏幕截图所示
它只是创建一个自定义标题,如文档的示例
您可以与垫式日历一起使用
<mat-calendar [headerComponent]="exampleHeader" [(selected)]="date"> </mat-calendar>
请参阅示例的分叉 stackblitz 此处
上面的 stackblitz 没有显示如何正确设置日历标题的格式。如果您希望标题以“MMMM YYYY”格式显示。将 periodLabel() 更改为以下内容:
get periodLabel() { return this._dateAdapter.format(this._calendar.activeDate, this._dateFormats.display.monthYearA11yLabel); }