mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 13:47:02 +08:00
23 lines
480 B
Markdown
23 lines
480 B
Markdown
|
# 指定不可选择日期
|
||
|
|
||
|
- order: 6
|
||
|
|
||
|
设置 `disabledDate` 方法,来确定不可选时段。
|
||
|
|
||
|
如上例:不可选择今天之后的日期。
|
||
|
|
||
|
---
|
||
|
|
||
|
````jsx
|
||
|
import { DatePicker } from 'antd';
|
||
|
|
||
|
const disabledDate = function(current, value) {
|
||
|
// can not select days after today
|
||
|
return current && current.getTime() > Date.now();
|
||
|
};
|
||
|
|
||
|
ReactDOM.render(
|
||
|
<DatePicker disabledDate={disabledDate} />
|
||
|
, document.getElementById('components-date-picker-demo-disabled-date'));
|
||
|
````
|