我想在redux-form的Field组件中关闭浏览器在输入字段上的自动完成功能,但从未起作用。我的代码如下。
import { Field, reduxForm } from 'redux-form/immutable';
import { TextField } from 'redux-form-material-ui';
<Field
name="username"
component={TextField}
placeholder="Username"
label="Username"
InputProps={{ autoComplete: 'off' }} // this never works even though in the DOM's element, the attribute autocomplete="off" has already been exist
required
validate={[required]}
className={classes.field}
/>这里出了什么问题?
发布于 2020-05-02 01:53:46
实际的自动完成被应用于由component参数指定的基本输入。为component提供该autoComplete prop值将为您解决该问题。
<Field
component={(props) => (
<TextField
...
inputProps={{
...props.inputProps,
autoComplete: 'no-autocomplete'
}}
/>
)}
/>https://stackoverflow.com/questions/60775017
复制相似问题