Element el-form

problem description

element el-form;vue-toolsel-form10item9

the environmental background of the problems and what methods you have tried

appears in the background where rules,model, is bound. At present, my processing method is to add an empty el-form-item that is not displayed

.

related codes

         <el-form v-if="dialogRadio==1" :model="replyForm" v-loading="listLoading">
          <el-form-item>
            <el-input v-model="replyForm.reply"  type="textarea" resize="none" :rows="4" ></el-input>
          </el-form-item>
        </el-form>
          <!--*********
              rules************************-->
        <el-form v-else  :model="demandForm"  ref="demandForm" label-width="130px" :rules="rules" v-loading="listLoading" status-icon>
          <el-form-item v-if="false">
            <el-input type="hidden"></el-input>
          </el-form-item>
          <el-form-item label="" prop="companyName" style="width: 70%">
            <el-input v-model="demandForm.companyName"  maxlength="30"></el-input>
          </el-form-item>
          <el-form-item label="" prop="contacts" style="width: 45%; display: inline-block">
            <el-input v-model="demandForm.contacts"  maxlength="30"></el-input>
          </el-form-item>
          <el-form-item label="/" prop="mobile" style="width: 45%; display: inline-block" >
            <el-input v-model="demandForm.mobile"  maxlength="30"></el-input>
          </el-form-item>
          <el-form-item label="" prop="description">
            <el-input v-model="demandForm.description" :rows="3" resize="none" type="textarea" maxlength="1000"></el-input>
          </el-form-item>
          <el-form-item label="" prop="projectName" style="width: 70%" >
            <el-input v-model="demandForm.projectName" maxlength="30"></el-input>
          </el-form-item>
          <el-form-item label="" prop="putTypeArr">
            <el-checkbox-group v-model="demandForm.putTypeArr" >
              <el-checkbox label="1"></el-checkbox>
              <el-checkbox label="2"></el-checkbox>
              <el-checkbox label="3"></el-checkbox>
            </el-checkbox-group>
          </el-form-item>
          <el-form-item label="" prop="expectTime" style="width: 45%; display: inline-block">
            <el-input v-model="demandForm.expectTime"  maxlength="30"></el-input>
          </el-form-item>
          <el-form-item label="" prop="budget" style="width: 45%; display: inline-block" >
            <el-input v-model="demandForm.budget"   maxlength="9" type="number"></el-input>
          </el-form-item>
          <el-form-item label="" prop="serviceName" style="width: 45%; display: inline-block">
            <el-input v-model="demandForm.serviceName"  maxlength="30"></el-input>
          </el-form-item>
          <el-form-item label="" prop="serviceMobile" style="width: 45%; display: inline-block" >
            <el-input v-model="demandForm.serviceMobile"></el-input>
          </el-form-item>
        </el-form>

what result do you expect? What is the error message actually seen?

if I remove the type=hidden item, the term "contact unit" is not included in the el-form, resulting in the fact that rules is not useful for this item;
has not found any other partners with this problem. If there is any error in the code, ask your partner to bring it up.

Sep.16,2021

I see your form uses v-if and v-else. Does the rule change when you cut it? do you have no contact unit when you v-if?


this problem is that v-if can efficiently reuse components, which can be solved by adding key to components that need to be rendered independently.

ide/conditional.html" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/guide.

Menu