【发布时间】:2020-05-18 22:12:22
【问题描述】:
我在我的 react 应用程序中使用 ant design time picker,我的时间针有一些冲突,我想知道如何在今天当前时间之前禁用过去的时间。
这是我的代码
getDisabledTime = () => {
var hours = [];
for(var i =0; i < moment().hour(); i++){
hours.push(i);
}
return hours;
}
<TimePicker onChange={onChange} disabledTimes={this.getDisabledTimes()}/>
【问题讨论】:
-
看起来你使用了错误的道具?有一个
disabledHours,如果这就是你要找的。span> -
@maazadeeb 你能解释一下吗?
-
在您链接的文档页面上,
TimePicker上没有名为disabledTimes的道具。 -
@maazadeeb 你好,我试过了,但没用,你能更新答案吗