vue.js - 如何将十六进制颜色代码设置为“tbody-tr-class”?(引导程序)
问题描述
我正在尝试b-table
用不同的颜色设置行。bootstrap-vue 有一个类tbody-tr-class
。
<b-table
head-variant="light"
:tbody-tr-class="rowClass"
:items="Clients"
:fields="headers"
>
现在,该类返回一些用十六进制颜色代码分配的自定义颜色。
rowClass(item, type) {
if (!item || type !== "row") return;
if (item.color_id === 1) return "table-hexvalue1";
else return "table-hexvalue2";
},
我已经尝试分配这样的课程:
<style lang="scss" scoped>
.hexvalue1 {
background-color: #D9FFBC;
color: #D9FFBC;
}
.hexvalue2 {
background-color: #fd7e14;
color: #fd7e14;
}
</style>
它不工作!如何将十六进制颜色代码设置为tbody-tr-class
?
解决方案
为您的班级名称留出间距,例如
rowClass(item, type) {
if (!item || type !== "row") return;
if (item.color_id === 1) return "table hexvalue1";
else return "table hexvalue2";
},
因为您只为.hexvalue1
and指定了样式.hexvalue2
推荐阅读
- java - Spring-boot Restful 服务中我的 Request 参数 Interceptor 有什么问题?
- python - 类似于黄金分割率的递归算法
- maven - 强化排除文件位置
- dax - 在 DAX 中查找去年的同一工作日
- typescript - 打字稿在带有休息参数的子中断中生成一个新实例
- javascript - 使用jquery删除输入后无法重新计算动态添加输入的总和?
- javascript - 在 HighCharts 中绘制 JSON 数据时遇到问题
- amazon-web-services - 如何使用 Cloudformation 在特定端口上映射 LoadBalancer ListenerRule?
- cscore - AudioPlayerSample 方法或操作未实现
- javascript - 不时获取“jQuery.Deferred 异常:$(...) 不是函数”