diff --git a/src/common/Check.tsx b/src/common/Check.tsx index c30ec48ff2..f2a0f07cbc 100644 --- a/src/common/Check.tsx +++ b/src/common/Check.tsx @@ -64,6 +64,8 @@ const Check = forwardRef((_props, ref) => { [`${classPrefix}-is-indeterminate`]: indeterminate, }); + const isDisabled = disabled || readonly; + const input = ( ((_props, ref) => { setInternalChecked(!e.currentTarget.checked, { e }); } }} - onChange={(e) => setInternalChecked(e.currentTarget.checked, { e })} + onChange={(e) => { + if (isDisabled) return; + setInternalChecked(e.currentTarget.checked, { e }); + }} /> ); // Checkbox/ Radio 内容为空则不再渲染 span,不存在 0:Number 的情况 @@ -96,6 +101,7 @@ const Check = forwardRef((_props, ref) => { }; const onInnerClick = (e: MouseEvent) => { + if (isDisabled) return; onClick?.({ e }); };