vue 使用Element 的form表单如何校验对象中的对象属性?
1、校验对象中的对象属性, 需要特殊处理下:
<template v-if="form.dataType === 0"> <el-form-item label="芯片类型" prop="configExtend.schemeVersion"> <el-select v-model="form.configExtend.schemeVersion" clearable size="mini"> <el-option v-for="(dict, index) in cidOptions" :key="index" :label="dict.dictLabel" :value="dict.dictLabel" /> </el-select> </el-form-item> <el-form-item label="测试协议" prop="configExtend.agreementVersion"> <el-select v-model="form.configExtend.agreementVersion" clearable size="mini"> <el-option v-for="(dict, index) in testAgreementList" :key="index" :label="dict.dictLabel" :value="dict.dictLabel" /> </el-select> </el-form-item> <el-form-item label="PCBA SN格式" prop="configExtend.pcbaSn"> <el-input v-model="form.configExtend.pcbaSn" clearable placeholder="请输入PCBA SN格式" /> </el-form-item> <el-row> <el-col> <el-form-item label="测试项目" prop="configExtend.testInfo" style="width: 100%;"> <el-card shadow="nerver"> <el-checkbox-group v-model="form.configExtend.testInfo"> <el-checkbox v-for="(dict, index) in testProjectList" :label="dict.dictLabel" :key="index" > {{ dict.dictLabel }} </el-checkbox> </el-checkbox-group> </el-card> </el-form-item> </el-col> </el-row> </template>