【发布时间】:2021-03-31 23:11:32
【问题描述】:
我有一个有几个输入的反应应用程序。问题是,每当我导航到该页面时,它都会使用以前在 Microsoft Edge(新的)上输入的数据自动填充所有字段。我使用 Materialize 进行造型。我这样实现我的表单:
<form onSubmit={this.handleSubmit} autoComplete='off' className="login-form">
<div className="input-field">
<input
placeholder='Type email here'
id="email"
type="email"
required
className="validate contact-input"
onChange={this.handleChange}/>
<label
className="active"
htmlFor="email">Email</label>
</div>
<div className="input-field">
<input
placeholder='Type password here'
id="password"
type="password"
required
className="validate contact-input"
onChange={this.handleChange}/>
<label
className="active"
htmlFor="password">Password</label>
</div>
<div className="input-field col s6">
<button className="btn z-depth-2 login-btn">
Sign In
</button>
</div>
</form>
我尝试过的一些不起作用的解决方案包括:
<form autoComplete="off">
...
</form>
<form autoComplete="new-password">
...
</form>
<input autoComplete="off" />
<input autoComplete="new-password" />
<input autoComplete="none" />
有人知道如何解决这个问题吗?
【问题讨论】:
-
试过了。出现的问题是 autoComplete="false" 但它保持清晰几秒钟然后再次填充
-
一个古老的讨论说它被简单地忽略了:stackoverflow.com/questions/42652094/… 并提供了使用 javascript 的解决方法。 github里也有一个有趣的讨论:gist.github.com/runspired/b9fdf1fa74fc9fb4554418dea35718fe
标签: reactjs materialize