<el-table class="margin-top-16" :data="selectedTableData" :header-cell-class-name="headerCellClassName" style="width: 100%" height="400"> <el-table-column prop="name" label="" min-width="130" /> <el-table-column> <template #default="scope"> <el-icon :size="18"><CircleClose /></el-icon> </template> </el-table-column> </el-table>
/** * 给表头添加class * @param param0 */ function headerCellClassName({ row, column, rowIndex, columnIndex }: any){ if(rowIndex === 0){ return 'el-table-header-cell-bg'; } }
标签:自定义,表头,element,添加,table,class From: https://www.cnblogs.com/tlfe/p/18657382