vue 验证
<Form :model="formModel" label-position="center" :label-width="90" ref="modelForm" :rules="rules"> rules: { inspectCycleValue: [ { validator: validateInterval, trigger: "blur" } ],} const validateInterval = (rule, value, callback) => { if(this.formModel.cycleValue == "其他"){ if (value === "") { callback(new Error("请填写巡检周期")); } else if (!/^[0-9]*$/.test(value)) { callback(new Error("只能输入整数")); } else if (value.charAt(0) == 0) { callback(new Error("不能以‘0’开头")); }else { callback(); } }else { callback(); } };