refactor(components): 优化 Check 和 Radio 组件的 onChange 事件类型定义
- 在 CheckBoxProps 和 RadioProps 接口中,将 onChange 事件的参数变更为可选参数 - 这种改动增加了组件的灵活性,允许在某些情况下不传递 onChange 事件的参数
This commit is contained in:
@@ -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) => {
|
||||||
|
@@ -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) => {
|
||||||
|
Reference in New Issue
Block a user