问题原因
为了防止浏览器自动将记住的密码回填进type="password"输入框,所以在type="password"输入框上面加了两行代码,使浏览器将密码填充到新加的输入框里(.hide-input样式将两个输入框隐藏):
<input type="text" class="hide-input">
<input type="password" class="hide-input">
<el-input v-model="form.password" show-password placeholder="请输入密码"></el-input>
但是这样就会导致,使用tab键切换时,也会经过新加的两个输入框,体验上就有断层感。
解决方法
为两个输入框加上 tabIndex=-1 属性
<input type="text" class="hide-input" tabIndex=-1>
<input type="password" class="hide-input" tabIndex=-1>
<el-input v-model="form.password" show-password placeholder="请输入密码"></el-input>