element form 表单验证 深层对象验证方法

这种格式的form如何验证

form: {
        premiumCalculate: { seven: '', sevenNumber: '' },
        insuredCompany: { insuranceServices: [] },
        premiumRate: {}
      },

、、prop 就要这样写了
<el-form-item
          label="本保险年度内需要提供的事故预防服务"
          prop="insuredCompany.insuranceServices"
        >
          <el-checkbox-group
            v-model="form.insuredCompany.insuranceServices"
          >
            <el-checkbox name="insuranceServices" label="安全风险辩识及评估">安全风险辩识及评估</el-checkbox>
            <el-checkbox name="insuranceServices" label="事故隐患排查">事故隐患排查</el-checkbox>
            <el-checkbox name="insuranceServices" label="风险管理培训">风险管理培训</el-checkbox>
            <el-checkbox name="insuranceServices" label="法律法规推送">法律法规推送</el-checkbox>
            <el-checkbox name="insuranceServices" label="其他">其他</el-checkbox>
          </el-checkbox-group>
          <el-input v-if="form.insuredCompany.insuranceServices.indexOf('其他')!==-1" v-model="form.insuredCompany.specialText" placeholder="请输入其他" />
        </el-form-item>


//roule 可以这样写
rules: {
        insuredCompany: {
          insuranceServices: [
            { type: 'array', required: true, message: '请选择本保险年度内需要提供的事故预防服务', trigger: 'change' }
          ]
        }

      }
上一篇:位图法统计活跃用户


下一篇:TMS320F28335光伏并网逆变器生产资料