網(wǎng)站首頁 編程語言 正文
目錄
一 、需求
二、方法之cell-style
1 、cell-style
2 、表格綁定cell-style屬性
3 、數(shù)據(jù)操作
三 、方法之el-tag
1 、el-table-column
2、方法eachColor(){}
一 、需求
根據(jù)列表列值的不同顯示不同顏色
二、方法之cell-style
1 、cell-style
cell-style 單元格的 style 的回調(diào)方法,也可以使用一個固定的 Object 為所有單元格設(shè)置一樣的 Style。 Function({row, column, rowIndex, columnIndex})/Object
- row:當(dāng)前行
- columnIndex:?列下標(biāo)
2 、表格綁定cell-style屬性
<el-table :data="tableData" :row-style="rowState" :cell-style="cellStyle" style="width: 100%" >
3 、數(shù)據(jù)操作
const cellStyle= ({ row, column, rowIndex, columnIndex })=> { // 狀態(tài)列字體顏色 if (row.level >2 && columnIndex === 8) { return {'color': 'red'}; //方法1 return "color: #FF0000"; //方法2 } }
三 、方法之el-tag
1 、el-table-column
<el-table-column label="姓名" width="180"> <template slot-scope="scope"> <el-tag :type="eachColor(scope.row.level)">{{ scope.row.level }}</el-tag> </el-popover> </template> </el-table-column>
2、方法eachColor(){}
eachColor(level) { if (level == "5") { return "danger"; } if (level == "4") { return "warning"; } if (level == "3") { return "info"; } ... },
有用請點(diǎn)贊,養(yǎng)成良好習(xí)慣!
疑問、交流、鼓勵請留言!
原文鏈接:https://libusi.blog.csdn.net/article/details/129655650
- 上一篇:沒有了
- 下一篇:沒有了
相關(guān)推薦
- 2022-11-14 flutter中使用流式布局示例詳解_Android
- 2022-12-31 Android入門之Service的使用詳解_Android
- 2022-11-22 .NET中實(shí)現(xiàn)對象數(shù)據(jù)映射示例詳解_實(shí)用技巧
- 2022-06-10 Asp.Net?Core使用Ocelot結(jié)合Consul實(shí)現(xiàn)服務(wù)注冊和發(fā)現(xiàn)_實(shí)用技巧
- 2022-09-02 react?hooks閉包陷阱切入淺談_React
- 2022-06-02 jquery實(shí)現(xiàn)淘寶商品圖片局部放大_jquery
- 2023-07-05 cnpm安裝appium出現(xiàn)cannot find module xxx
- 2023-01-27 解決Pycharm模塊安裝慢問題的兩種方法_python
- 欄目分類
-
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支