Vue <el-table>标签实现表头换色及多个表头换色

一般的表头换色可以使用 header-cell-style:{background:"color"}就行了

如果你想要实现多个表头换色,比如

这种分色的样式可以使用header-cell-class-name这个官网提供的方法,用法也很简单

 这行代码的意思是,找到你选中的类名,后面接的是方法名rowtable。

方法如下:

 设一个下标参数然后寻找对应的label值然后返回一个对应的类就好了,接下来就可以在对应的类下面加样式了

非常简单,很容易看懂,希望能帮到你! 

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
<el-table ref="singleTable" :data="configs" border class="wraper-table" element-loading-text="Loading" fit highlight-current-row size="mini" style="margin: 0px 0 20px 0"> <el-table-column :label="$t('table.select')" width="50" align="center"> <template slot-scope="scope"> <el-radio v-model="radio" :label="scope.row.id" @change="chooseOne(scope.row)">{{ '' }}</el-radio> </template> </el-table-column> <el-table-column :label="$t('table.id')" align="center" width="50"> <template v-slot="scope"> {{ initTableIndex('page', scope.$index) }} </template> </el-table-column> <el-table-column :label="$t('i18nView.pdCode')" align="center" prop="pdCode"></el-table-column> <el-table-column :label="$t('i18nView.pdName')" align="center" prop="pdName"></el-table-column> <el-table-column :label="$t('customComponents.pdEdition')" align="center" prop="pdEdition"></el-table-column> <el-table-column :label="$t('pdtempPdInfoView.pdApplDate')" align="center" prop="pdApplDate" sortable></el-table-column> <el-table-column :label="$t('pdtempPdInfoView.updateTime')" align="center" prop="changeDate" sortable> <template v-slot="scope"><span v-if="scope.row.defType!=1">{{ scope.row.changeDate }}</span></template> </el-table-column> <el-table-column :label="$t('pdtempPdInfoView.definitionType')" align="center" prop="defType"> <template v-slot="scope">{{ scope.row.defType | filterDefType }}</template> </el-table-column> <el-table-column :filter-method="filterHandler" :filters="filterHandlerList1" :label="$t('pdtempPdInfoView.attributeDefinitionState')" align="center" prop="attrDefState"></el-table-column> <el-table-column :filter-method="filterHandler" :filters="filterHandlerList2" :label="$t('pdtempPdInfoView.structureDefinitionState')" align="center" prop="structDefState"></el-table-column> <el-table-column :filter-method="filterHandler" :filters="filterHandlerList3" :label="$t('pdtempPdInfoView.currentPriceDefinitionState')" align="center" prop="priceDefState"></el-table-column> <el-table-column :filter-method="filterHandler" :filters="filterHandlerList4" :label="$t('pdtempPdInfoView.superviseDefinitionState')" align="center" prop="superviseDefState"></el-table-column> </el-table> <!-- 分页 --> <cus-pagination ref="page" v-model="configs" :pageSize="10" :params="params" url="/pdtemp-pd-info/list"/>以上代码如何实现数据渲染
07-22

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值