【发布时间】:2021-03-26 22:40:33
【问题描述】:
我正在使用 vue-slider。 我想改变滑块的颜色。 类名是“vue-slider-dot-tooltip-inner”。
现在我想像这样更改边框颜色和背景颜色。
.vue-slider-dot-tooltip-inner {
font-size: 14px;
white-space: nowrap;
padding: 2px 5px;
min-width: 20px;
text-align: center;
color: #fff;
border-radius: 5px;
border-color: #FBF6F7;
background-color: #FBF6F7;
box-sizing: content-box;
}
于是我尝试修复vue代码中的css代码。
我的模板。
<div class="slider">
<vue-slider
v-model="value"
:dragOnClick="true"
:adsorb="true"
:marks="data.name"
:included="true"
:data="bar"
:data-value="'id'"
:data-label="'name'"
class="vue-slider-rail"
></vue-slider>
</div>
css
<style lang="scss" scoped>
.vue-slider-dot-tooltip-inner {
font-size: 14px;
white-space: nowrap;
padding: 2px 5px;
min-width: 20px;
text-align: center;
color: #fff;
border-radius: 5px;
border-color: #FBF6F7!important;
background-color: #FBF6F7!important;
box-sizing: content-box;
}
</style>
但是我的 css 代码不起作用,所以我尝试了另一个 css 代码。
<style lang="scss" scoped>
.slider >>> .vue-slider-dot-tooltip-inner {
font-size: 14px;
white-space: nowrap;
padding: 2px 5px;
min-width: 20px;
text-align: center;
color: #fff;
border-radius: 5px;
border-color: #FBF6F7!important;
background-color: #FBF6F7!important;
box-sizing: content-box;
}
</style>
这段代码也不起作用,所以我需要有人帮我改变颜色。
【问题讨论】:
-
您是否看到开发工具中的样式被其他规则覆盖,或者您根本没有看到上面的规则?
-
我没有看到上面的规则。
-
在我提交答案之前,让我们确保这不是范围问题。如果您从样式定义中删除
scoped,您看到规则了吗? (删除scoped时可以删除>>>深度选择器)
标签: javascript html css vue.js sass