本文介绍了has-danger 不再适用于 Bootstrap v4 测试版?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据引导程序迁移指南:

将 .has-error 重命名为 .has-danger.

然而,这似乎不起作用.边框和文本未着色.

例如:

<label class="form-control-label" for="inputDanger1">输入有危险</label><input type="text" class="form-control form-control-danger" id="inputDanger1"><div class="form-control-feedback">抱歉,该用户名已被占用.试试另一个?</div><small class="form-text text-muted">保持不变的帮助文本示例.</small>

演示:

https://jsfiddle.net/uLa0spfm/

解决方案

由于 Bootstrap 4 仍处于 Beta 版,大部分迁移文档是 与实际版本不同步.测试版中的验证已更改,并且has-danger 不再存在.

另见:无法进行验证在 Bootstrap 4 中工作

According to the Bootstrap migration guide:

However, that doesn't seem to work. Border and text has not been coloured.

For example:

<div class="form-group has-danger">
    <label class="form-control-label" for="inputDanger1">Input with danger</label>
    <input type="text" class="form-control form-control-danger" id="inputDanger1">
    <div class="form-control-feedback">Sorry, that username's taken. Try another?</div>
    <small class="form-text text-muted">Example help text that remains unchanged.</small>
</div>

Demo:

https://jsfiddle.net/uLa0spfm/

解决方案

Being that Bootstrap 4 is still in Beta, much of the migration documentation is not in sync with actual releases. Validation has changed in beta, and has-danger no longer exists.

Also see: Can't make the validation work in Bootstrap 4

这篇关于has-danger 不再适用于 Bootstrap v4 测试版?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 18:52