javascript - Bootstrap-Vue b-tab:CSS 似乎不适用于 active-nav-item-class
问题描述
我正在尝试使用 Bootstrap-Vue 中的选项卡。我正在尝试调整活动选项卡上的样式。从https://bootstrap-vue.org/docs/components/tabs#active-classes的文档中,我看到了这个更改活动选项卡样式的示例。我知道我要修改 active-nav-item-class 属性,如下所示:
<b-tabs
active-nav-item-class="font-weight-bold text-success"
active-tab-class="font-weight-bold text-success"
content-class="mt-3"
>
在您可以在https://jsfiddle.net/b4o1kL2f/1/看到的我的 JSFiddle 中,我同样尝试通过将其与 Vue 绑定来将 active-nav-item-class 设置为 CSS 中的类样式:
<b-tabs pills vertical :active-nav-item-class="'tab-active-class'">
这是CSS:
.tab-active-class {
background-color: red;
}
但似乎活动选项卡背景颜色没有改变。谁能发现我可能做错了什么?非常感谢!
解决方案
该类适用于 HTML 元素,但问题是其.nav-link.active
特异性超过.tab-active-class
,因此您必须增加.tab-active-class
.nav-link.active.tab-active-class {
background-color: red;
}
或者
.tab-active-class {
background-color: red !important;
}
推荐阅读
- aws-lambda - 为什么使用 apex deploy 两个别名分配在同一个版本中?
- angular - Angular 7 导航正在相应地更改 URL,但不加载组件
- python-3.x - 如何编写每次达到特定数字时输出单独值的脚本
- python - 从分组列中另一个 DataFrame 的每一行创建 DataFrame?
- c# - Visual Studio 2019:使用来自 Web 表单的参数在 C# 中运行 SQL 查询
- ios - 如何通过在 Swift 中提供标头来调用 REST 完整 API
- java - Java 线程中断仅等待、加入和睡眠
- python - 检查变量是否为无,但如果只有一个对象/数组则让其通过
- reactjs - 反应在菜单点击上显示单独的弹出框组件
- regex - 在[另一个单元格中的字符串]中找到[单元格中的字符串]时返回真/假?