vue.js手机号正则表达式验证
getCode() {if (this.mobile === '') {this.$vux.toast.show({type: 'text',text: '请输入手机号',time: 2000});this.selected = tru...
·
getCode() {
if (this.mobile === '') {
this.$vux.toast.show({
type: 'text',
text: '请输入手机号',
time: 2000
});
this.selected = true;
} else {
if (!/^((1[3,5,8,7,9][0-9])|(14[5,7])|(17[0,6,7,8])|(19[1,7]))\d{8}$/.test(this.mobile)) {
this.$vux.toast.show({
type: 'text',
width: '10em',
text: '手机号格式不正确',
time: 2000
})
} else {
this.$vux.toast.show({
type: 'text',
width: '10em',
text: '手机号格式正确',
time: 2000
})
}
}
},
由于运营商的号段在不断增加,不及时更新请见谅~
更多推荐
已为社区贡献11条内容
所有评论(0)