【发布时间】:2020-06-16 15:20:55
【问题描述】:
在我的 React 应用程序中,我使用的是 MaterialUI 表单控件 API 文本字段。在 Select 标记中,我触发了一个 onClick 方法,但它仅在第一次单击后触发。我没有对这些标签应用任何隐藏的 CSS。以下是sn-p:
<FormControl style={{ width: '12em', marginTop: '1em' }} variant="outlined">
<InputLabel htmlFor="outlined-age-native-simple">Select Template</InputLabel>
<Select
native
label="Select-Template"
onClick={this.GetTemplates}
>
{templates.length &&
templates.map(x => (
<option
key={x.template_id}
value={JSON.stringify(x.template_content)}
style={{ border: 'solid' }}>
{x.template_name}
</option>
))}
</Select>
</FormControl>
功能:
GetTemplates = e => {
XRayApi.getTemplates(this.getTemplatesApiResponse);
};
我根本找不到原因。有什么帮助吗?
【问题讨论】:
标签: javascript reactjs material-ui