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

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 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
      <DatePickerCustom
        onChange={onChange}
        picker="date"
        style={{ marginRight: '10px', marginBottom: '10px' }}
      />
      <DatePickerCustom
        onChange={onChange}
        picker="week"
        style={{ marginRight: '10px', marginBottom: '10px' }}
      />
      <DatePickerCustom
        onChange={onChange}
        picker="month"
        style={{ marginRight: '10px', marginBottom: '10px' }}
      />
      <DatePickerCustom
        onChange={onChange}
        picker="quarter"
        style={{ marginRight: '10px', marginBottom: '10px' }}
      />
      <DatePickerCustom
        onChange={onChange}
        picker="year"
        style={{ marginRight: '10px', marginBottom: '10px' }}
      />
      <div style={{ display: 'flex' }}>
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
        <Input
          value={startTime}
          placeholder="起始时间"
          style={{ marginRight: '10px', width: '250px' }}
        />
        <Input
          value={endTime}
          placeholder="结束时间"
          style={{ marginRight: '10px', width: '250px' }}
        />
      </div>
    </>
  );
};

export default Demo;