给input设置一个默认的readonly
属性,
然后通过 onfocus="this.removeAttribute('readonly')"
和 onblur="this.setAttribute('readonly',true)"
来改变这个状态,让输入框可以输入或者只读,这样就不会被记住密码填充了。
<el-input
v-model.trim="loginForm.password"
placeholder="请输入密码"
show-password
name="password"
@keyup.enter.native="handleLogin"
readonly
onfocus="this.removeAttribute('readonly')"
onblur="this.setAttribute('readonly',true)"
/>