使用餓了么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: [],
               },
          }
      }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM