【发布时间】:2021-08-18 18:14:01
【问题描述】:
我有自动完成和重置按钮。我需要按下按钮我的状态被重置。所以我需要在自动完成中使用状态作为一个值。我可以做吗? (state.type="") 我使用类组件
<Autocomplete
className={classes.root}
id="combo-box-demo"
options={availableTypes}
getOptionLabel={(option) => option.title}
onChange={this.changeType}
renderInput={(params) => (
<TextField
className={classes.wrapper}
{...params}
label="choose any type"
/>
)}
/>
【问题讨论】:
-
您想在单击按钮时清除所选的自动完成值吗?
-
可以分享代码沙箱上的代码吗
-
是的,我想清除选定的值
标签: reactjs redux autocomplete material-ui