mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 00:29:12 +08:00
34 lines
863 B
TypeScript
34 lines
863 B
TypeScript
|
import React from 'react';
|
||
|
import type { DatePickerProps } from 'antd';
|
||
|
import { DatePicker, Flex } from 'antd';
|
||
|
import dayjs from 'dayjs';
|
||
|
import type { Dayjs } from 'dayjs';
|
||
|
|
||
|
const onChange: DatePickerProps<Dayjs[]>['onChange'] = (date, dateString) => {
|
||
|
console.log(date, dateString);
|
||
|
};
|
||
|
|
||
|
const defaultValue = [dayjs(), dayjs().add(1, 'day'), dayjs().add(2, 'day')];
|
||
|
|
||
|
const App: React.FC = () => (
|
||
|
<Flex vertical gap="small">
|
||
|
<DatePicker
|
||
|
multiple
|
||
|
onChange={onChange}
|
||
|
maxTagCount="responsive"
|
||
|
defaultValue={defaultValue}
|
||
|
size="small"
|
||
|
/>
|
||
|
<DatePicker multiple onChange={onChange} maxTagCount="responsive" defaultValue={defaultValue} />
|
||
|
<DatePicker
|
||
|
multiple
|
||
|
onChange={onChange}
|
||
|
maxTagCount="responsive"
|
||
|
defaultValue={defaultValue}
|
||
|
size="large"
|
||
|
/>
|
||
|
</Flex>
|
||
|
);
|
||
|
|
||
|
export default App;
|