一.普通数据格式的校验
let ruleForem = {
name:''
}
this.$refs[Form].validateField('name');
二.带有表格嵌套数据的校验
<el-table-column label="性别" align="center">
<template slot-scope="scope">
<el-form-item prop="`tableData.${scope.$index}.sex`" :rules="rules.sex">
<el-select
v-model="scope.row.sex"
placeholder="请选择性别"
@change="validate(scope.$index)"
>
</el-select>
</el-form-item>
</template>
</el-table-column>
let ruleForm = {
tableData:[{sex:"",age:""}]
}
validate(index){
const prop = `tableData.${index}.sex`;
this.$refs["ruleForm"].validateField(prop);
}