简体   繁体   English

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

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

Is it possible to remove the focus on today's date when using Angular Material datepicker?使用 Angular Material datepicker 时是否可以移除对今天日期的关注? I have tried adding the following properties to mat-datepicker but nothing seems to work and I can't find a way to do this:我尝试将以下属性添加到 mat-datepicker,但似乎没有任何效果,我找不到方法来做到这一点:

  • restoreFocus="false"恢复焦点=“假”
  • [startAt]="null" [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>

For example, I don't want the focus/background on 16 in the image below.例如,我不希望下图中 16 的焦点/背景。

角材料日期选择器

I need to do this because I am trying to use Angular Material datepicker for the users to enter their date of birth and the focus on today's date is irrelevant in this case.我需要这样做,因为我正在尝试使用 Angular Material datepicker 让用户输入他们的出生日期,在这种情况下,今天的日期无关紧要。

apply This class inside style.css file of your project and re run project again.. Basically you need to change default css class implementation.在你的项目的 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.

相关问题 Angular Material Calendar 设置始终关注今天的日期 - Angular Material Calendar set always focus on today's date day 如何从Angular Material中删除日期选择器的默认日期选择? - How to remove default date selection of datepicker from Angular Material? 如何在角形材料的日期选择器中使用当日日期的高亮蓝色自动对焦? - How to autofocus with highlight blue color on today date in datepicker of angular material? 如何从 angular 材料日期选择器中删除填充 - How to remove padding from angular material datepicker 如何从角度材料日期选择器更改日期? - How to change the date from angular material datepicker? Angular 物料日期选择器拣货日期自动对焦离开 - Angular material datepicker picking date automatically on focus leave Angular Material Datepicker成为焦点 - Angular Material Datepicker open on focus 如何基于另一个 Datepicker 从 Angular 材料 Datepicker 验证日期 - How can I validate the Date from a Angular material Datepicker based on another Datepicker 如何将昨天的日期作为出现在 mat-datepicker 中的日期 - angular 素材 - How to make yesterday's date as the date to appear in mat-datepicker - angular material 如何从材料日期选择器中删除禁用年份? - How to remove disabled years from material datepicker?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM