使用饿了么ui表单验证报错: [Element Warn][Form]model is required for validat

[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: [],
               },
          }
      }
}

 

posted @ 2018-09-19 19:44  yuwenjing  阅读(3487)  评论(0编辑  收藏  举报