element中根据状态改变el-table某个字体颜色
<div
:style="scope.row.projectInfo.status==1?
'color: #E6A23C;':scope.row.projectInfo.status==2?
'color: #67C23A':scope.row.projectInfo.status==3?
'color: #909399;':scope.row.projectInfo.status==4?
'color: #F56C6C':''">
{
{scope.row.projectInfo.status1}}
</div>
格式可能有问题,这样写方便查看源码如下
<el-table-column
align="center"
label="状态"
prop="projectInfo.status1"
show-overflow-tooltip
color
>
<template slot-scope="scope">
<div
:style="scope.row.projectInfo.status==1?'color: #E6A23C;':scope.row.projectInfo.status==2?'color: #67C23A':scope.row.projectInfo.status==3?'color: #909399;':scope.row.projectInfo.status==4?' color: #F56C6C':''">
{
{scope.row.projectInfo.status

本文介绍了如何在Vue.js项目中结合Element UI库,根据数据状态动态改变el-table组件中字体的颜色。通过CSS3选择器和Vue的条件渲染实现表格单元格颜色的智能变化。
最低0.47元/天 解锁文章
946

被折叠的 条评论
为什么被折叠?



