[Element Warn][Form]model is required for validat
如文末的完整例子:
该提示说的是 form表单需要一个绑定一个 对象(使用:model="editform" 不能使用v-model="editform"),
同时v-model="multipleSelectionStudent" 的multipleSelectionStudent一定一定一定要在editform对象中,
而例子中v-model="multipleSelectionStudent" 的multipleSelectionStudent就不一定在editform对象中,因为此字段,没有做验证.
<el-form :model="editForm" ref="form" label-position="left" label-width="100px"> <el-row :gutter="24"> <el-col :span="12"> <el-form-item label="姓名"> <el-input v-model="multipleSelectionStudent" placeholder="请选择"></el-input> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="地区" prop="selectSources" :rules="[ { required: true, message: ‘请选择地区‘, trigger: ‘change‘}]"> <el-cascader v-model="editForm.selectSources" placeholder="请选择" :clearable="true" :options="options.resourceGroup" change-on-select :props="cascaderProp" class="el-cascader-100p" ></el-cascader> </el-form-item> </el-col> </el-row> </el-form> export default { data():{ return { editForm: { selectSources: [], }, } } }
原文地址:https://www.cnblogs.com/yuwenjing0727/p/9676620.html
时间: 2024-11-09 09:57:54