element-ui 表单v-if 很多人会遇到无法验证的问题,网上很多是在el-form-item标签前加一个div然后把v-if拿到div上去像这样

<div v-if="addchannel.region=='postgresql'||addchannel.region=='mongodb'||addchannel.region=='mysql'||addchannel.region=='influxdb'"
            class="notlastchildren notline">
              <el-form-item
            :label="addchannel.region+'密码'"
            label-width="200px"
            prop="postgresqlpassword"
            :rules='[
              {required:true,message:"密码不能为空",trigger: "blur"}
              ]'
          >
            <el-input
              :type="pwdType"
              placeholder="密码"
              v-model="addchannel.postgresqlpassword"
              class="notauto readonly"
              readonly
            >
              <template slot="append">
                <span class="show-pwd" @click="showPwd">
                  <svg-icon :icon-class="isopen" />
                </span>
              </template>
            </el-input>
          </el-form-item>
</div>

这样也有可能不行,其实再套一层div就可以了

<div v-if="addchannel.region=='postgresql'||addchannel.region=='mongodb'||addchannel.region=='mysql'||addchannel.region=='influxdb'"
            class="notlastchildren notline">
            <div>
              <el-form-item
            :label="addchannel.region+'密码'"
            
            label-width="200px"
            prop="postgresqlpassword"
            :rules='[
              {required:true,message:"密码不能为空",trigger: "blur"}
              ]'
          >
            <el-input
              :type="pwdType"
              placeholder="密码"
              v-model="addchannel.postgresqlpassword"
              class="notauto readonly"
              readonly
            >
              <template slot="append">
                <span class="show-pwd" @click="showPwd">
                  <svg-icon :icon-class="isopen" />
                </span>
              </template>
            </el-input>
          </el-form-item>
            </div>
</div>

 

相关文章:

  • 2021-12-30
  • 2021-12-04
  • 2021-07-08
  • 2021-05-15
  • 2021-10-19
  • 2021-11-13
  • 2021-01-08
  • 2021-11-28
猜你喜欢
  • 2021-10-12
  • 2021-02-04
  • 2020-01-15
  • 2021-10-19
  • 2021-08-29
  • 2021-08-02
  • 2021-11-11
  • 2021-11-03
相关资源
相似解决方案