2016-03-31 09:40:55 +08:00
|
|
|
---
|
2016-11-11 12:08:18 +08:00
|
|
|
order: 4
|
2016-06-19 11:17:09 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 禁用
|
|
|
|
en-US: Disabled
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-12-10 16:12:10 +08:00
|
|
|
|
2016-06-19 11:17:09 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2019-12-11 23:32:19 +08:00
|
|
|
选择框的不可用状态。你也可以通过数组单独禁用 RangePicker 的其中一项。
|
2015-12-10 16:12:10 +08:00
|
|
|
|
2016-06-19 11:17:09 +08:00
|
|
|
## en-US
|
|
|
|
|
2019-12-11 23:32:19 +08:00
|
|
|
A disabled state of the `DatePicker`. You can also set as array to disable one of input.
|
2016-06-19 11:17:09 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```jsx
|
2020-07-30 19:17:34 +08:00
|
|
|
import { DatePicker, Space } from 'antd';
|
2022-02-14 14:40:40 +08:00
|
|
|
import dayjs from 'dayjs';
|
|
|
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
|
|
|
|
|
|
dayjs.extend(customParseFormat);
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2020-07-23 11:25:17 +08:00
|
|
|
const { RangePicker } = DatePicker;
|
2015-12-10 16:12:10 +08:00
|
|
|
|
2016-11-11 12:08:18 +08:00
|
|
|
const dateFormat = 'YYYY-MM-DD';
|
2022-04-03 23:27:45 +08:00
|
|
|
export default () => (
|
2020-07-30 19:17:34 +08:00
|
|
|
<Space direction="vertical" size={12}>
|
2022-02-14 14:40:40 +08:00
|
|
|
<DatePicker defaultValue={dayjs('2015-06-06', dateFormat)} disabled />
|
|
|
|
<DatePicker picker="month" defaultValue={dayjs('2015-06', 'YYYY-MM')} disabled />
|
2016-11-11 12:08:18 +08:00
|
|
|
<RangePicker
|
2022-02-14 14:40:40 +08:00
|
|
|
defaultValue={[dayjs('2015-06-06', dateFormat), dayjs('2015-06-06', dateFormat)]}
|
2016-11-11 12:08:18 +08:00
|
|
|
disabled
|
|
|
|
/>
|
2019-12-11 23:32:19 +08:00
|
|
|
<RangePicker
|
2022-02-14 14:40:40 +08:00
|
|
|
defaultValue={[dayjs('2019-09-03', dateFormat), dayjs('2019-11-22', dateFormat)]}
|
2019-12-11 23:32:19 +08:00
|
|
|
disabled={[false, true]}
|
|
|
|
/>
|
2022-04-03 23:27:45 +08:00
|
|
|
</Space>
|
2018-11-28 15:00:03 +08:00
|
|
|
);
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|