inputPwd: (function () {
var map = {};
function inputPwd(el) {
// var $el = $(el);
// var key = $el.attr('input-pwd');
// map[key] = $el;
this.el = el;
this.initInput();
}
inputPwd.prototype.initInput = function () {
var that = this;
var el = this.el;
el.status = 'hide'; // 初始时,默认隐藏状态
el.pwdValue = ''; // pwdValue 属性,用于存储真正的密码
el.type = 'text'; // 强制 input type 为 text, 防止用户设置 password 类型从而造成影响
el.setAttribute('ime-mode', 'disabled');
if (el.value) {
// 如果存在默认密码,则将默认密码存入 pwdValue,并渲染一次密码
el.pwdValue = el.value;
this.toggleRender();
}
// 开始进行中文输入时触发的事件
el.addEventListener('compositionstart',
模拟input 密码框效果 (中文输入法处理)
最新推荐文章于 2023-07-04 11:02:06 发布