From 93142b1a0b53a9954ae7755fb47c050a733d91d5 Mon Sep 17 00:00:00 2001 From: Zz-ZzzZ <1136261471@qq.com> Date: Mon, 11 Dec 2023 10:12:46 +0800 Subject: [PATCH] fix(DatePicker): fix error disabled --- src/date-picker/hooks/useSingle.tsx | 1 + 1 file changed, 1 insertion(+) 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') {