首页 前端知识 Vue中el-table修改单独列的字体颜色、样式,用cell-style写函数

Vue中el-table修改单独列的字体颜色、样式,用cell-style写函数

2024-02-08 15:02:56 前端知识 前端哥 55 276 我要收藏

Vue中el-table修改单独列的字体颜色、样式,用cell-style写函数,在el-table中加cell-style,在scipt的methods中加入函数的具体写法

  1. 先在el-table中加入cell-style:
<el-table
v-if="activeTab == 'xxx'"
class="table-dark"
:data="aaa"
:cell-style="cell"
>
复制
  1. 再在script的methods中实现函数:
methods: {
//改变单行蓝色和绿色
cell({row , column , rowIndex , columnIndex}){
if(columnIndex==0){
return 'color: green'
}
if(columnIndex==3){
return 'color: blue'
}
},
}
复制
转载请注明出处或者链接地址:https://www.qianduange.cn//article/1541.html
标签
评论
还可以输入200
共0条数据,当前/页
会员中心 联系我 留言建议 回顶部
复制成功!