refactor(components): 优化 Check 和 Radio 组件的 onChange 事件类型定义

- 在 CheckBoxProps 和 RadioProps 接口中,将 onChange 事件的参数变更为可选参数
- 这种改动增加了组件的灵活性,允许在某些情况下不传递 onChange 事件的参数
This commit is contained in:
Vixalie
2025-08-12 14:10:31 +08:00
parent ebac9d006b
commit e22e64fdac
2 changed files with 2 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ interface CheckBoxProps {
name?: string; name?: string;
checked?: boolean; checked?: boolean;
disabled?: boolean; disabled?: boolean;
onChange?: (checked: boolean) => void; onChange?: (checked?: boolean) => void;
} }
const Check: ParentComponent<CheckBoxProps> = (props) => { const Check: ParentComponent<CheckBoxProps> = (props) => {

View File

@@ -14,7 +14,7 @@ interface RadioProps {
name?: string; name?: string;
checked?: boolean; checked?: boolean;
disabled?: boolean; disabled?: boolean;
onChange?: (value: boolean) => void; onChange?: (value?: boolean) => void;
} }
const Radio: ParentComponent<RadioProps> = (props) => { const Radio: ParentComponent<RadioProps> = (props) => {