美文网首页
不让浏览器保存密码的解决方法

不让浏览器保存密码的解决方法

作者: me__me11 | 来源:发表于2017-07-07 18:58 被阅读0次

1.css样式 -webkit-text-security: disc;

2.js 用的vue写的

<div class="input">
      <input type="text" class="password" Width="300" ID="txtMask" MaxLength="30" Enabled="false" v-model="mask">
      <input type="text" class="password" Width="300" ID="txtPassword" MaxLength="30" v-model="password" @keyup="enter">
    </div>
data () {
    return {
      mask: '',
      password: ''
    }
  },
methods: {
    enter() {
      var s = '';
      for (var i = 0; i < this.password.length; i++)
        s = s + '*';
      this.mask = s;
    }
  }
#txtPassword {
    opacity:0;
  }
  input {
    width: 200px;
    line-height: 40px;
    font-size: 18px;
  }
  div.input {
    position: relative;
  }
  div.input input {
    position: absolute;
    left: 0;
  }
<input onfocus="this.type='password'" autocomplete="off" placeholder="8-20位字母和数字组合登录密码" type="password">

相关文章

网友评论

      本文标题:不让浏览器保存密码的解决方法

      本文链接:https://www.haomeiwen.com/subject/qtsrhxtx.html