谷歌浏览器制止表单自动添补

在项目开辟时期发明谷歌浏览器有记着暗码的功用,该功用有个题目就是一碰到input type=password就最先自动添补,同一个账户还好,就是bug了。找了一堆解决计划终究找到了方法,下面分享一下解决计划。
1、不见效计划:

<input type="text"  style="display: none;" disabled autocomplete = "off"/>
<input type="password"  style="display: none;" disabled autocomplete = "off"/>
<input autocomplete="off" type="text" /> 
<input autocomplete="off" type="text" onfocus="this.type='password'" />

附:在表单的情况下再加一个input隐蔽的体式格局去添补,对我来讲无效。谷歌版本 73.0.3683.86(正式版本) (64 位)

解决计划:
1、能够在不需要默许填写的input框中设置 autocomplete=”new-password” (亲测有用)

<input type="password" v-model="form.password" class="form_input" autocomplete="new-password" placeholder="请输入/>

2、修正readonly属性

<input type="password" readonly onfocus="this.removeAttribute('readonly');"/> 

这类体式格局的话觉得不如计划一来的好,不过也是能够的。
另有其他的解决计划不过我没有实验,这两种是卓有成效的方法。
参考资料:
https://blog.csdn.net/xw50550…
https://stackoverflow.com/que…

    原文作者:LazyHua
    原文地址: https://segmentfault.com/a/1190000018762788
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞