You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
472 B
23 lines
472 B
9 years ago
|
# 指定不可选择日期
|
||
10 years ago
|
|
||
9 years ago
|
- order: 6
|
||
10 years ago
|
|
||
10 years ago
|
设置 `disabledDate` 方法,来确定不可选时段。
|
||
10 years ago
|
|
||
10 years ago
|
如上例:不可选择今天之后的日期。
|
||
10 years ago
|
|
||
|
---
|
||
|
|
||
|
````jsx
|
||
9 years ago
|
import { DatePicker } from 'antd';
|
||
9 years ago
|
|
||
|
const disabledDate = function(current, value) {
|
||
10 years ago
|
// can not select days after today
|
||
9 years ago
|
return current && current.getTime() > Date.now();
|
||
10 years ago
|
};
|
||
10 years ago
|
|
||
9 years ago
|
ReactDOM.render(
|
||
9 years ago
|
<DatePicker disabledDate={disabledDate} />
|
||
|
, document.getElementById('components-date-picker-demo-range'));
|
||
10 years ago
|
````
|