【发布时间】:2020-06-22 14:53:58
【问题描述】:
是否可以在选择默认值的情况下呈现 SelectInput?我需要使用选择的默认语言加载页面。谢谢。
我的代码:
export const CT_SELECT_I18N = [
{id: 'en', text: 'English'},
{id: 'pt', text: 'Português'},
{id: 'es', text: 'Español'},
];
const renderSelect = ({
meta: {touched, error} = {},
input: {...inputProps},
...props
}) => (
<SelectInput
error={!!(touched && error)}
helperText={touched && error}
{...inputProps}
{...props}
fullWidth
source="idioma"
choices={Constants.CT_SELECT_I18N}
translateChoice={false}
optionValue="id"
optionText="text"
/>
);
【问题讨论】: