mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix: 修复BoolSetter的defaultValue不生效的问题
This commit is contained in:
parent
0cf47daac1
commit
a701d5ef3d
@ -23,10 +23,18 @@ export const StringSetter = {
|
||||
},
|
||||
};
|
||||
export const NumberSetter = NumberPicker;
|
||||
export class BoolSetter extends Component {
|
||||
export class BoolSetter extends Component<any> {
|
||||
render() {
|
||||
const { onChange, value, defaultValue } = this.props;
|
||||
return <Switch checked={value} defaultChecked={defaultValue} onChange={onChange} />;
|
||||
const props: Record<string, any> = {
|
||||
defaultChecked: defaultValue,
|
||||
onChange,
|
||||
};
|
||||
// Switch是通过 'checke' in props 来判断是否使用 defaultChecked
|
||||
if (typeof value !== 'undefined') {
|
||||
props.checked = value;
|
||||
}
|
||||
return <Switch {...props} />;
|
||||
}
|
||||
}
|
||||
export const SelectSetter = Select;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user