禁用P日历中的单个日期 [英] Disable single date in p-calendar
本文介绍了禁用P日历中的单个日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个日历,我想禁用某个日期,例如10/7/2018,我正在使用
I have a calender and I want to disiable a certain date eg 10/7/2018, I am using p-calendar
这是我到目前为止所做的事情
Here is what I have done so far
<p-calendar formControlName="date" [inline]="true" [disabledDays]="[10]" [minDate]="minimumDate" tabindex="0">
<ng-template pTemplate="date" let-date>
<span [ngStyle]="{backgroundColor: (date.day ==10) ? '#7cc67c' : 'inherit'}" style="border-radius:50%">{{date.day}}</span>
</ng-template>
</p-calendar>
这不起作用,
我的代码有什么问题?
What is wrong with my code?
推荐答案
您正在使用[disabledDays]
,其中每个值代表一周中的某一天,因此任何大于6的值均无效.您需要的是disabledDates
,它应该是Date
对象的数组.
You're using [disabledDays]
, where each value represents a day of the week, so any value > 6 is invalid. You want disabledDates
instead, which should be an array of Date
objects.
链接到的文档中应该有更多信息.
There should be more info in the documentation that you linked to.
这篇关于禁用P日历中的单个日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文