primeNG日历上禁用日期的样式不起作用

时间:2020-09-10 07:58:38

标签: angular primeng primeng-calendar

我正在尝试为primeNG日历上的某些禁用日期添加样式,在文档中建议使用disabledDateTemplate。但是,这似乎不起作用,我也无法在线找到一个解决方案。

1 个答案:

答案 0 :(得分:0)

您可以像这样覆盖失效日期的样式

style.css

p-calendar td span.p-disabled {
  color: red !important;
  background: orange !important
}

global theme

或者您可以设置一个自定义类,以便样式不会影响所有组件

模板

<p-calendar styleClass="custom-theme" 
            [(ngModel)]="dateValue" 
            [disabledDates]="invalidDates" 
            [disabledDays]="[0,6]" 
            [readonlyInput]="true">
</p-calendar>

style.css

p-calendar .custom-theme  td span.p-disabled {
  color: #fff !important;
  background: darkred !important
}

enter image description here

demo ?