我想禁用自动填充和自动完成谷歌铬选项,我尝试了变体解决方案,如:
在自动完成类*autocomplete="off"中设置
有什么解决办法吗?
发布于 2020-07-11 17:12:53
我找到了一个解决办法:
1 -将输入type=“文本”设置为只读:
<input type="text" [readonly]="inputText" />2 -将输入类型密码设置为输入文本,并将设置为看起来类似于密码输入:
html:
<input type="text" [readonly]="inputPassword" class="pw-field"/>css:
.pw-field{
-webkit-text-security: disc;
}3-在两个输入中添加一个focusEvent:
html:
<input type="text" [readonly]="inputText" (focus)='focusFunction("text")' />
<input type="text" [readonly]="inputPassword" class="pw-field" (focus)='focusFunction("pw")' />ts:
focusFunction(type){
if(type == "text"){
this.inputText = false;
this.inputPassword = true;
}else if(type == "pw"){
this.inputText = false;
this.inputPassword = true;
}
}https://stackoverflow.com/questions/62852191
复制相似问题