From e22e64fdac88d08112d3a94b6d10cd8305c8b639 Mon Sep 17 00:00:00 2001 From: Vixalie Date: Tue, 12 Aug 2025 14:10:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor(components):=20=E4=BC=98=E5=8C=96=20Ch?= =?UTF-8?q?eck=20=E5=92=8C=20Radio=20=E7=BB=84=E4=BB=B6=E7=9A=84=20onChang?= =?UTF-8?q?e=20=E4=BA=8B=E4=BB=B6=E7=B1=BB=E5=9E=8B=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 CheckBoxProps 和 RadioProps 接口中,将 onChange 事件的参数变更为可选参数 - 这种改动增加了组件的灵活性,允许在某些情况下不传递 onChange 事件的参数 --- src/components/Check.tsx | 2 +- src/components/Radio.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Check.tsx b/src/components/Check.tsx index 36a809f..47453ad 100644 --- a/src/components/Check.tsx +++ b/src/components/Check.tsx @@ -14,7 +14,7 @@ interface CheckBoxProps { name?: string; checked?: boolean; disabled?: boolean; - onChange?: (checked: boolean) => void; + onChange?: (checked?: boolean) => void; } const Check: ParentComponent = (props) => { diff --git a/src/components/Radio.tsx b/src/components/Radio.tsx index 2c061ce..5d6f19b 100644 --- a/src/components/Radio.tsx +++ b/src/components/Radio.tsx @@ -14,7 +14,7 @@ interface RadioProps { name?: string; checked?: boolean; disabled?: boolean; - onChange?: (value: boolean) => void; + onChange?: (value?: boolean) => void; } const Radio: ParentComponent = (props) => {