我有这个自动完成下拉框。
如果我在下拉列表中选择了其他值,那么我如何接受自动填充下拉框以接受自定义值。在此示例中,bar和bat值在下拉菜单中。
我如何接受袋子作为输入值?
my code is at : https://codesandbox.io/s/material-demo-8scos
export default function ComboBox() {
return (
<Autocomplete
id="combo-box-demo"
options={top100Films}
getOptionLabel={option => option.title}
style={{ width: 300 }}
renderInput={params => (
<TextField {...params} label="Combo box" variant="outlined" />
)}
/>
);
}
const top100Films = [
{ title: "bar", year: 1994 },
{ title: "bat", year: 1972 }
];