为了防止浏览器自动将记住的密码回填进type="password"输入框,所以在type="password"输入框上面加了两行代码,使浏览器将密码填充到新加的输入框里,并将这两个input隐藏掉

<input type="password" autocomplete="off" style='width:0;height:0;min-height:0'>
<input type="text" autocomplete="off" style='width:0;height:0;min-height:0'>

但是出现一个问题是点击tab键时会跳到这两个input里

在原生html中可以添加tabindex="-1"属性,点击tab时会自动跳过这个input

    <input placeholder="第一个input">
    <input tabindex="-1" placeholder="第二个input">
    <input placeholder="第三个input">

但是uniapp中的input没有这个属性

可以使用这个(:disabled="true")来代替,能够实现一样的功能

<input :disabled="true" type="password" autocomplete="off" style='width:0;height:0;min-height:0'/>
<input :disabled="true" type="text" autocomplete="off" style='width:0;height:0;min-height:0'/>

更多推荐