1、html
<div class="main_item__edit"
v-if="[32, 512].includes(handleParams.handleType)">
<label class="required">通知电话</label>
<el-input v-model="handleParams.phone"
minlength="3"
maxlength="20"
@blur="phoneChange($event)"
type="number"></el-input>
</div>
2、js
phoneChange(e) {
console.log("e", e.currentTarget.value);
const { phone, handleType, handler } = this.handleParams;
if ([32, 512].includes(handleType) && !phoneFun(phone)) {
this.$message.warning("请输入正确的通知电话");
return false;
}
},

3、引入外部验证方法
import { phoneFun } from '@/utils/index';

export function phoneFun(phones) {
var myreg = /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/;
if (!myreg.test(phones)) {
console.log('手机号格式不正确');
return false;
} else {
console.log('手机号格式正确');
return true;
}
}