Material-UI自动完成-禁用下划线也会禁用可清除

时间:2020-03-06 00:02:07

标签: reactjs material-ui

我有以下代码:

<Autocomplete
    freeSolo={true}
    options={this.state.data}
    getOptionLabel={option => option.dataNumber}
    renderInput={params =>
        <TextField {...params}
            ref={ this.searchInput }
            name="search"
            onKeyPress={(ev) => {
                if (ev.key === 'Enter') {
                    this.handleSubmit(ev);
                }
            }}
            onChange={ event => this.handleChange(event) }
            InputLabelProps={{
              shrink: false
            }}
            InputProps={{
               disableUnderline: true
            }}
            placeholder={"Search"}  />
    }
/>

问题是我想禁用下划线,但这也禁用了 x 来清除输入。我尝试添加disableClearable={false} 但还是不行。
任何帮助或指导,将不胜感激!非常感谢。

0 个答案:

没有答案