//页面
//方法
// 1、监听身份证输入
Listeningfocus(){
console.log(this.inputForm.sfz)
if(this.inputForm.sfz!=''){
this.getCardTypeNumber(this.inputForm.sfz)
}
},
// 2、检验身份证是否正确
getCardTypeNumber(value){
const reg = /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
if( reg.test(value) === false && value){
uni.showToast({
icon: "none",
title:'请输入正确格式的身份证号码',
duration: 2000,
position: 'top'
})
}else {
console.log('身份证号码格式正确')
}
},
原创©本文章为梁鹏翱原创,未经许可,禁止转载
0条评论