判断是否是数字和字母的组合:

if (this.passWordA.match(/\d/) && this.passWordA.match(/[a-zA-Z]/)) {

} else {
this.$toast('请输入6~16位字母与数字的组合')
return false
}

判断是否有非法字符:

let pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
let rs = ''
for (let i = 0; i < this.passWordA.length; i++) {
rs = rs + this.passWordA.substr(i, 1).replace(pattern, '')
}
if (rs !== this.passWordA) {
this.$toast('请勿输入非法字符!')
return false
}
 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2022-12-23
相关资源
相似解决方案