import { useCallback, useState } from 'react'; import { Button, DatePicker, DatePickerProps } from 'antd'; import React from 'react'; type DatePickerLongProps = { longValue?: any, longText?: any, } type Props = DatePickerLongProps & DatePickerProps; export default function DatePickerLong(props: Props) { const { value, onChange, longText = '长期', longValue = 'long', // 长期值, ...others } = props; const [ open, setOpen ] = useState(false); // 用户点击长期 const handleLongClick = useCallback(() => { if (onChange) { onChange(longValue, longValue); } setOpen(false); }, [ longValue, onChange ]); // 是否是长期 const isLong = value === longValue; // 长期,面板上不选中日期 const _value = isLong ? null : value; return (