【发布时间】:2018-10-15 18:05:59
【问题描述】:
我正在使用以下代码在AsyncSelect 输入上禁用autocomplete,但inputProps 似乎没有被应用。
<AsyncSelect
placeholder="Search a city"
styles={customStyles}
onChange={this._onChangeCity}
loadOptions={this._loadMatchedCities}
inputProps={{ autoComplete: 'nope', autoFill:'off' }}
defaultOptions={true}
noOptionsMessage={this._noOptionsMessage}
loadingMessage={({inputValue}) => 'Loading cities...'}
/>
当我在 Chrome 上检查输入元素时,它显示:
<input type="text" autocapitalize="none" autocomplete="off" autocorrect="off" id="react-select-2-input" spellcheck="false" tabindex="0" value="" aria-autocomplete="list" style="box-sizing: content-box; width: 2px; background: 0px center; border: 0px; font-size: inherit; opacity: 1; outline: 0px; padding: 0px; color: inherit;" data-reactid="59">
如果我在检查的元素上手动更改为autocomplete="nope",自动完成功能将被关闭,因此很明显,inputProps={{ autoComplete: 'nope', autoFill:'off' }} 不会被应用。
还有现有的autocomplete="off"不关闭autocomplete,我用的是Chrome Version 69.0.3497.100 (Official Build) (64-bit)
这是我要解决的问题。
任何想法为什么? 谢谢
【问题讨论】:
标签: html input autocomplete react-select input-field