From 6f8c75cd6da2ea69044491bc8fa8c661d32b49af Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Mon, 11 Apr 2022 21:12:25 +0800 Subject: [PATCH] fix: timeRangePicker ts type support string --- components/time-picker/time-picker.tsx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/components/time-picker/time-picker.tsx b/components/time-picker/time-picker.tsx index 5de8ec637..49015c84e 100644 --- a/components/time-picker/time-picker.tsx +++ b/components/time-picker/time-picker.tsx @@ -46,10 +46,25 @@ export interface CommonTimePickerProps { hideDisabledOptions?: boolean; popupClassName?: string; } - -export type TimeRangePickerProps = Omit, 'picker'> & { +export type TimeRangePickerProps = Omit< + RangePickerTimeProps, + 'picker' | 'defaultPickerValue' | 'defaultValue' | 'value' | 'onChange' | 'onPanelChange' | 'onOk' +> & { popupClassName?: string; valueFormat?: string; + defaultPickerValue?: RangeValue | RangeValue; + defaultValue?: RangeValue | RangeValue; + value?: RangeValue | RangeValue; + onChange?: ( + value: RangeValue | RangeValue | null, + dateString: [string, string], + ) => void; + 'onUpdate:value'?: (value: RangeValue | RangeValue | null) => void; + onPanelChange?: ( + values: RangeValue | RangeValue, + modes: [PanelMode, PanelMode], + ) => void; + onOk?: (dates: RangeValue | RangeValue) => void; }; export type TimePickerProps = CommonProps & @@ -151,9 +166,7 @@ function createTimePicker< slot: ['renderExtraFooter', 'suffixIcon', 'clearIcon'], setup(props, { slots, expose, emit, attrs }) { const pickerRef = ref(); - const formItemContext = useInjectFormItemContext(); - expose({ focus: () => { pickerRef.value?.focus();