【发布时间】:2020-04-27 08:34:49
【问题描述】:
我正在使用 Material UI 自动完成功能,但遇到了这个问题。在documentation 中,它说“该值必须与选项具有引用相等性才能被选中”。我完全按照它所说的做了,但似乎它不起作用。
<Autocomplete
disableCloseOnSelect={true}
multiple
options={techList}
getOptionLabel={(options) => options.techName}
value={newValueDialog}
onChange={(e, tech) => {
this.handleChangeValueDialog(tech);
}}
popupIcon={false}
closeIcon={false}
renderTags={(value, getTagProps) =>
value.map((option, index) => (
<Chip
color="primary"
variant="outlined"
label={option.techName}
{...getTagProps({ index })}
deleteIcon={<ClearIcon />}
/>
))
}
renderInput={(params) => (
<TextField
{...params}
variant="outlined"
placeholder="Technology"
fullWidth
/>
)}
/>
【问题讨论】:
标签: material-ui