el-table给列加单位,表头加样式,加斑马纹
<el-table
ref="table"
class="dataTable"
:data="detailList"
:header-cell-style="tableHeaderColor"
:row-class-name="tableRowClassName"
highlight-current-row>
<el-table-column label="序号" align="center" min-width="40px">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column prop="sum" label="总金额" min-width="80px">
<template slot-scope="scope">{{ scope.row.money}}元</template>
</el-table-column>
</el-table>
methods:{
tableRowClassName({ rowIndex }) {
if (rowIndex % 2 === 0) {
return "striped-row";
}
return "";
},
tableHeaderColor() {
return { background: "#4D76FF !important", color: "#FFFFFF !important", border: 0, fontSize: "14px" };
},
}
<style>
/deep/ .el-table .striped-row {
background-color: #f7f9ff !important;
}
</style>
想给列加单位:<template slot-scope="scope">{{ scope.row.money}}</template>
想给表头加样式::header-cell-style="tableHeaderColor"
想给table加斑马纹::row-class-name="tableRowClassName"
原文地址:https://blog.csdn.net/weixin_42414634/article/details/142517888
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!