diff --git a/src/date-picker/hooks/useRange.tsx b/src/date-picker/hooks/useRange.tsx index def7d176f3..d94f16b13d 100644 --- a/src/date-picker/hooks/useRange.tsx +++ b/src/date-picker/hooks/useRange.tsx @@ -123,6 +123,7 @@ export default function useRange(props: TdDateRangePickerProps) { overlayInnerStyle: props.popupProps?.overlayInnerStyle ?? { width: 'auto' }, overlayClassName: classNames(props.popupProps?.overlayClassName, `${name}__panel-container`), onVisibleChange: (visible: boolean, context) => { + if (props.disabled) return; // 这里劫持了进一步向 popup 传递的 onVisibleChange 事件,为了保证可以在 Datepicker 中使用 popupProps.onVisibleChange,故此处理 props.popupProps?.onVisibleChange?.(visible, context); // 输入框点击不关闭面板 diff --git a/src/date-picker/hooks/useSingle.tsx b/src/date-picker/hooks/useSingle.tsx index f66e3bb8b2..505a0d5866 100644 --- a/src/date-picker/hooks/useSingle.tsx +++ b/src/date-picker/hooks/useSingle.tsx @@ -106,6 +106,7 @@ export default function useSingleInput(props: TdDatePickerProps) { overlayInnerStyle: props.popupProps?.overlayInnerStyle ?? { width: 'auto' }, overlayClassName: classNames(props.popupProps?.overlayClassName, `${name}__panel-container`), onVisibleChange: (visible: boolean, context: any) => { + if (props.disabled) return; // 这里劫持了进一步向 popup 传递的 onVisibleChange 事件,为了保证可以在 Datepicker 中使用 popupProps.onVisibleChange,故此处理 props.popupProps?.onVisibleChange?.(visible, context); if (context.trigger === 'trigger-element-mousedown') {