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">
网友评论