base.tsx 1.23 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import React, { useContext, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Input } from 'antd';
import DatePickerCustom from '../index';

const Demo = (props) => {
  const [startTime, setStartTime] = useState('');
  const [endTime, setEndTime] = useState('');
  const onChange = (date, dateString) => {
    console.log(date);
    setStartTime(date.startTime);
    setEndTime(date.endTime);
  };
  return (
    <>
李纪文's avatar
李纪文 committed
17
      <DatePickerCustom onChange={onChange} picker="date" style={{ marginRight: '10px' }} />
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
      <DatePickerCustom onChange={onChange} picker="week" style={{ marginRight: '10px' }} />
      <DatePickerCustom onChange={onChange} picker="month" style={{ marginRight: '10px' }} />
      <DatePickerCustom onChange={onChange} picker="year" style={{ marginRight: '10px' }} />
      <div style={{ display: 'flex', marginTop: '10px' }}>
        <Input
          value={startTime}
          placeholder="起始时间"
          style={{ marginRight: '10px', width: '250px' }}
        />
        <Input
          value={endTime}
          placeholder="结束时间"
          style={{ marginRight: '10px', width: '250px' }}
        />
      </div>
    </>
  );
};

export default Demo;