繁体   English   中英

如何在 Angular Material Datepicker 中从今天的日期中移除焦点?

[英]How to remove the focus from today's date in Angular Material Datepicker?

使用 Angular Material datepicker 时是否可以移除对今天日期的关注? 我尝试将以下属性添加到 mat-datepicker,但似乎没有任何效果,我找不到方法来做到这一点:

  • 恢复焦点=“假”
  • [startAt]="空"
    <mat-form-field appearance="fill">
       <mat-label>Choose a date</mat-label>
       <input matInput [matDatepicker]="picker">
       <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
       <mat-datepicker #picker></mat-datepicker>
    </mat-form-field>

例如,我不希望下图中 16 的焦点/背景。

角材料日期选择器

我需要这样做,因为我正在尝试使用 Angular Material datepicker 让用户输入他们的出生日期,在这种情况下,今天的日期无关紧要。

在你的项目的 style.css 文件中应用这个类并重新运行项目。基本上你需要更改默认的 css 类实现。

.mat-calendar-body-today:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) {
  background-color: rgb(255 255 255) !important;
  border: none !important;
 }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM