微信小程序 功能函数 手机号验证*

// 登录手机验证
loginPhone: function (e) {
var phone = e.detail.value;
if (!(/^1[34578]d{9}$/.test(phone))) {
this.setData({
ajxtrue: false
})
if (phone.length >= 11) {
wx.showToast({
title: '手机号有误',
icon: 'success',
duration: 2000
})
}
} else {
this.setData({
ajxtrue: true
})
}
},
原文地址:https://www.cnblogs.com/dianzan/p/8003882.html