el-form-item校验多个字段


    
    


    
    


    
    

data() {

return {
  visible: false,
  formmodel: {
    cycle:'1'
  },
  formRules: {
    date: [{ required: true, message: "请选择考勤月份" }],
    cycleEnd: [{ required: true, validator:(rules,value,callback)=>{
      let {cycleStart} = this.formmodel
      if (!value||!cycleStart) {
        return callback(new Error("请选择考勤周期"))
      }
      return callback()
    } }],
  },
  formRules2: {
    date: [{ required: true, message: "请选择考勤月份" }]
  }
};

},

你可能感兴趣的:(vue.js,element-ui)