mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-05 05:28:20 +08:00
22 lines
420 B
Markdown
22 lines
420 B
Markdown
---
|
|
order: 6
|
|
title: 指定不可选择日期
|
|
---
|
|
|
|
设置 `disabledDate` 方法,来确定不可选时段。
|
|
|
|
如上例:不可选择今天之后的日期。
|
|
|
|
````jsx
|
|
import { DatePicker } from 'antd';
|
|
|
|
const disabledDate = function (current) {
|
|
// can not select days after today
|
|
return current && current.getTime() > Date.now();
|
|
};
|
|
|
|
ReactDOM.render(
|
|
<DatePicker disabledDate={disabledDate} />
|
|
, mountNode);
|
|
````
|