问题复现: 输入内容符合rules 验证规则依旧报错
如下:页面输入符合规则 依旧报错
<el-form :model="querylearn" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="学段" prop="name">
<el-input v-model="querylearn.itemname"></el-input>
</el-form-item>
<el-form-item v-if="subject" label="学科" prop="sbuj">
<el-input v-model="querylearn.itemsbuj"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')">添加</el-button>
</el-form-item>
</el-form>
// data数据
querylearn: {
itemname: null,
itemsbuj: null
},
解决:
prop="name" //如果prop 为 name
v-model="querylearn.name" //那么 v-model 绑定的需要一样
......