el-form表单el-form-item验证规则里prop一次验证两个或多个值


  
-
data() {
  const valTowValue = (rule, value, callback) => {
    if (value == "" || value == undefined || value == null) {
      callback(new Error("请输入随机区间"));
    } else {
      if (!this.infoData.randowMax) {
        callback(new Error("请输入最大值"));
      } else if (!this.infoData.randowMin) {
        callback(new Error("请输入最小值"));
      } else if (Number(this.infoData.randowMin) >= Number(this.infoData.randowMax)) {
        callback(new Error("请输入正确的范围值"));
      } else {
        callback();
      }
    }
  };
}
rules: {
  randowMin: [{ validator: valTowValue, trigger: "blur" }],
},

你可能感兴趣的:(el-form表单el-form-item验证规则里prop一次验证两个或多个值)