在table中加 :cell-style="columnStyle"
<div class="xzysledgerTable" style="width: 100%; overflow-x:scroll">
<el-table v-loading="loading" border :data="xzysListAll" :cell-style="columnStyle">
<el-table-column label="单位" align="center" prop="deptId" width="150px">
<template slot-scope="scope">{{deptFxFormat(scope.row.deptId,deptFxOptions)}}</template>
</el-table-column>
<el-table-column label="案号" align="center" prop="reference" width="155px">
<template slot-scope="scope">{{scope.row.reference}}</template>
</el-table-column>
<el-table-column label="是否经复议" align="center" prop="isJfy" width="150px">
<template slot-scope="scope">{{scope.row.isJfy=='0'?dictFormat(scope.row.isJfy, isJfyOptions):(scope.row.fyjgName !=null && scope.row.fyjgName !=''?(dictFormat(scope.row.isJfy, isJfyOptions)+' '+scope.row.fyjgName):dictFormat(scope.row.isJfy, isJfyOptions))}}</template>
</el-table-column>
</el-table-column>
</el-table>
</div>
methods中加方法
//row, 每一行上的数据
//column, 每一列上的数据
//rowIndex, 行数的下标从0开始
//columnIndex 列数下标从0开始
columnStyle({ row, column, rowIndex, columnIndex }) {
//第一列的背景色
if (columnIndex == 0) {
return "background:#F0F0F0";
}
},