【问题标题】:CSS3 Bootstrap 4 How to handle theinput error message with inline inputsCSS3 Bootstrap 4 如何使用内联输入处理输入错误消息
【发布时间】:2018-02-09 11:33:32
【问题描述】:

我目前在同一行有 2 个输入字段要使用 vee-validate 进行验证(我使用的是 Vue.js)。

验证消息显示在input-group 的末尾,而不是其中。

这里是html代码:

<div class="form-group row d-flex justify-content-center">
  <div class="input-group input-group-lg col-md-3" >
    <input v-validate="'required'" name="username" v-model="username" type="text" class="form-control" placeholder="Your Name" aria-label="Name">
     <span v-show="errors.has('username')" class="help is-danger">{{ errors.first('username') }}</span>
  </div>
  <div class="input-group input-group-lg col-md-4" >
    <input v-validate="'required|email'" name="email" v-model="email" type="text" :class="{'input': true, 'is-danger': errors.has('email') }" class="form-control" placeholder="Your Email Address" aria-label="Email">
     <span v-show="errors.has('email')" class="help is-danger">{{ errors.first('email') }}</span>
  </div>
</div>

我的代码有什么问题?

【问题讨论】:

    标签: css vue.js vee-validate


    【解决方案1】:

    在错误文本中使用 Bootstrap .help-block 类。

    【讨论】:

    • 感谢 ed1nh0..;试过了。 (请参阅问题下方的更新...显示没有变化。似乎输入组已调整大小以适应输入字段(减小大小)和 p 段落 w 消息..
    • 知道了...需要删除使用 flex 的 input-goup ...我尝试将其设置为 flex: none;但它不会改变它的行为......
    猜你喜欢
    • 2015-10-10
    • 2010-10-15
    • 2018-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-23
    相关资源
    最近更新 更多