element的表单校验正常手机号码以及输入框填写“不详”的情况 <el-col :span="6"><el-form-item label="手机号码" prop="phoneNumber" class="grid-content bg-purple"><el-input v-model="testForm.phoneNumber" placeholder="请输入手机号码"></el-input></el-form-item></el-col> data(){let phoneNumberValider=(rule,value,callback)=>{if(value!=""){if(value=="不详"){callback();return}let reg11=/^[1][3,4,5,6,7,8,9][0-9]{9}$/;if(reg11.test(value)){callback()}else{callback(new Error("请输入正确格式手机号!"))}}else{callback()}};return{rules:{phoneNumber:[{required:true,message:'请输入手机号码',trigger:'blur'},{validator:phoneNumberValider,trigger:'blur'}],},} } 输入一个异常的手机号码进行校验 输入一个正常的手机号码进行校验 输入汉字“不详”进行校验