检查手机和名称是否仅包含vue中的数字和字母

时间:2019-01-20 19:23:04

标签: javascript jquery vue.js

我正在尝试这个

var pattern = /^[A-Za-z]+$/;
if(pattern.test(this.name)){
//code if there are only letters
}
var check = /^0-9$/;
if(check.test(this.mobile)){
//code if there is only numbers
}

这总是返回

  

错误

字母和数字

很抱歉有任何愚蠢的错误。感谢您的帮助

0 个答案:

没有答案