当前位置: 首页> 健康> 美食 > vue 给特定满足条件的表单数据添加背景颜色,组件的 row-class-name

vue 给特定满足条件的表单数据添加背景颜色,组件的 row-class-name

时间:2025/7/10 1:12:38来源:https://blog.csdn.net/UTF8_8/article/details/140498682 浏览次数:0次
1、:row-class-name="tableRowClassName" 可为表格每行根据后面的函数绑定class名
<!-- 列表框 --><div class="tableList"><el-table :data="teamModelListTable"  style="width: 100%"@selection-change="handleSelectionChange":row-class-name="tableClassNameRow"tooltip-effect="dark"id="newGridList"ref="gridShouldRespondList"><el-table-columntype="selection":reserve-selection="false"></el-table-column><el-table-column label="序号" type="index" width="100" align="center"><template slot-scope="scope">{{scope.$index + 1 + pageSize * (currentPage - 1)}}</template></el-table-column><el-table-column show-overflow-tooltip prop="feedName" label="反馈人" ></el-table-column><el-table-column show-overflow-tooltip prop="gridName" label="网格名称" ></el-table-column><el-table-column show-overflow-tooltip prop="finishSituation" label="完成情况"></el-table-column><el-table-column show-overflow-tooltip prop="isFinished" label="是否完成"></el-table-column></el-table>
methods: {tableClassNameRow(row, rowIndex) {console.log(row)if (row){if (row.isFinished != null || row.isReceived != null ){return 'is-finished-filled';}else {return '';}}},...其他方法
}
 .is-finished-filled {background-color: #07e56c !important; /* 高亮颜色,可以根据需求自定义 */font-weight: bold; /* 另外一种可能的高亮方式 */}

2、效果图

关键字:vue 给特定满足条件的表单数据添加背景颜色,组件的 row-class-name

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: