<input type="text" placeholder="请填写手机号" v-model="phone" maxlength="11" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" />
方法中验证:
var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
if (!myreg.test(this.phone)) {
alert('请填写正确手机号码!');
}else {
……
}
```
复制代码