element中一些场景必填校验的方式

普通表格循环方式情况下校验:

          

            

              

                

                  

                    v-for="(item, index) in warnForm.weekUserList"  :key="index" > {{ week[index] }}

                  

                

                

                  

                    "'weekUserList.' + index + '.userId'" :rules="rules.userId">

                      

                        

                        

                      

                    

                  

                

              

            

          

element table 中templete 校验方式:

 

        :model="setttingForm"

        ref="setttingForm"

        :rules="rules"

        label-width="120px"

      >

        

          

            

              :data="setttingForm.facilityUserList"

              class="parentTable"

              align="center"

            >

              

              

                label="问题名称"

                prop="problemName"

                align="center"

                min-width="120"

              >

                

                  

                    :prop="'facilityUserList.' + scope.$index + '.problemName'"

                    :rules="rules.problemName"

                  >

                    

                      v-model="scope.row.problemName"

                      autocomplete="off"

                    >

                  

                

              

              

                label="分管园长"

                prop="userList"

                align="center"

                min-width="120"

              >

                

                  

                    :prop="'facilityUserList.' + scope.$index + '.userList'"

                    :rules="rules.userList"

                  >

                    

                      v-model="scope.row.userList"

                      multiple

                      placeholder="请选择人员"

                    >

                      

                        v-for="dict in employeeCampus"

                        :key="dict.userId"

                        :label="dict.nickName"

                        :value="dict.userId"

                      >

                      

                    

                  

                

              

              

                label="操作"

                align="center"

                min-width="120px"

                class-name="small-padding fixed-width"

              >

                

                  

                    size="mini"

                    type="text"

                    icon="el-icon-circle-plus-outline"

                    @click="add()"

                    >添加一行

                  

                  

                    size="mini"

                    type="text"

                    icon="el-icon-delete"

                    v-if="

                      setttingForm.facilityUserList.length > 1 &&

                      scope.$index > 0

                    "

                    @click="del(scope.$index, scope.row)"

                    >删除

                  

                

              

            

          

        

      

你可能感兴趣的:(element中一些场景必填校验的方式)