标签:color span logs length pass == i++ 输入 new
要保证callback()只有一个出口
rules:{ newPassword: [{validator:(rule,newPassword,callback)=>{ var all = false if(newPassword == ‘‘){ callback(new Error("请输入密码")); }else{ var str = "" for(var i=0;i<newPassword.length;i++){ str = newPassword.charCodeAt(i) if(str > 65280 && str < 65375 || str == 12288){ all = true } } if(all == true){ callback(new Error("请输入半角字符")); }else{ callback() } } }, trigger:‘blur‘}] }
用户在设置密码时,提醒请输入半角字符(vue+element+valid)
标签:color span logs length pass == i++ 输入 new
原文地址:http://www.cnblogs.com/cnundefined/p/6993566.html