vue js 手写 正则判断 手机号码 和 密码

const phoneOrEmails = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/

            if(this.ruleForms.phoneOrEmail  == '' ||this.ruleForms.phoneOrEmail ==  undefined ){
                this.$message.error("请输入手机号码")
                return
            }
 
const emailReg = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,12}$/
 
if( !emailReg.test( this.ruleForms.password2 ) || !emailReg.test( this.ruleForms.password3 )  ){
                this.$message.error("密码只能由大小写字母开头并且长度不低于8位")
                return
            }
posted @ 2021-06-21 11:36  薛定谔_猫  阅读(395)  评论(0)    收藏  举报