mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 03:29:59 +08:00
docs: fixed nested ternary operator in Form (#27724)
This commit is contained in:
parent
652374ff4c
commit
3d04e5d3fb
@ -31,9 +31,17 @@ class Demo extends React.Component {
|
||||
formRef = React.createRef<FormInstance>();
|
||||
|
||||
onGenderChange = value => {
|
||||
this.formRef.current.setFieldsValue({
|
||||
note: `Hi, ${value === 'male' ? 'man' : value === 'female' ? 'lady' : 'there'}!`,
|
||||
});
|
||||
switch (value) {
|
||||
case 'male':
|
||||
this.formRef.current.setFieldsValue({ note: 'Hi, man!' });
|
||||
return;
|
||||
case 'female':
|
||||
this.formRef.current.setFieldsValue({ note: 'Hi, lady!' });
|
||||
return;
|
||||
case 'other':
|
||||
this.formRef.current.setFieldsValue({ note: 'Hi there!' });
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
onFinish = values => {
|
||||
|
Loading…
Reference in New Issue
Block a user