**JS实现代码:** `validatemobile:` `function` `(mobile) {` `if` `(mobile.length == 0) {` `wx.showToast({` `title:` `'请输入手机号!'``,` `icon:` `'success'``,` `duration: 1500` `})` `return` `false``;` `}` `if` `(mobile.length != 11) {` `wx.showToast({` `title:` `'手机号长度有误!'``,` `icon:` `'success'``,` `duration: 1500` `})` `return` `false``;` `}` `var` `myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/;` `if` `(!myreg.test(mobile)) {` `wx.showToast({` `title:` `'手机号有误!'``,` `icon:` `'success'``,` `duration: 1500` `})` `return` `false``;` `}` `return` `true``;` `}` 欢迎加入全栈开发交流划水交流圈:582735936 面向划水1-3年前端人员 帮助突破划水瓶颈,提高思惟能力