Fork me on GitHub

javascript积累

1.把手机号码中间四位替换成*

  var ciphertext = mobile.substr(0, 3) + '****' + mobile.substr(7);  
2.常用的手机号码验证  
  
   checkPhone: function(phoneNumber) {
        let str = /^1\d{10}$/;
        if (str.test(phoneNumber)) {
            return true;
        } else {
            wx.showModal({
                content: '手机号码不正确',
                showCancel: false
            });
            return false;
        }
    },

 

 


posted @ 2019-02-27 10:48  欢欢11  阅读(124)  评论(0编辑  收藏  举报