在微信里及QQ浏览器里ios短信回填vue方法取不到值,去除黄色背景

在微信里打开的网页,或者在qq浏览器里打开网页,发生短信,ios系统自带的键盘上方有短信验证码,点击就会回填到输入框中,输入框就是正常输入框,啥属性都不需要加,但是vue的方式取值是空,自动回填后,手输也会取不到。

1:没自动回填,手动输入可以取值;

2:自动回填,取不到值;回填后,再手输入,取不到值;

3:只有ios端(微信,qq浏览器)有问题;安卓端哪里都没问题;

解决方法:

document.getElementById('msgVerify').value;  用原生方法取值,直接取input输入框的值,实测没问题。

去除自动填充的输入框黄色背景:

input:-webkit-autofill{
  -webkit-box-shadow:0 0 0 1000px white inset;
  animation-name:autofill !important;
  animation-fill-mode:both !important;
}
@-webkit-keyframes autofill{
  to{
    background:transparent;
  }
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus{
  background-clip:content-box !important;
}

  

原文地址:https://www.cnblogs.com/wulinzi/p/15627626.html