Vue中el-table修改单独列的字体颜色、样式,用cell-style写函数,在el-table中加cell-style,在scipt的methods中加入函数的具体写法
- 先在el-table中加入cell-style:
<el-table
v-if="activeTab == 'xxx'"
class="table-dark"
:data="aaa"
:cell-style="cell"
>
- 再在script的methods中实现函数:
methods: {
//改变单行蓝色和绿色
cell({row , column , rowIndex , columnIndex}){
if(columnIndex==0){
return 'color: green'
}
if(columnIndex==3){
return 'color: blue'
}
},
}