template:
<el-table
? ? ? ? ? :height="HEIGHT"
? ? ? ? ? class="tableList"
? ? ? ? ? :data="tableData"
? ? ? ? ? :row-class-name="tableRowClassName"
? ? ? ? ? stripe
? ? ? ? ? style="width: 100%"
? ? ? ? ? element-loading-text="拼命加載中"
? ? ? ? ? element-loading-spinner="el-icon-loading"
? ? ? ? ? element-loading-background="rgba(0, 0, 0, 0.2)"
? ? ? ? ? v-loading="loadings"
? ? ? ? ></el-table>
js:
tableRowClassName ({ row, rowIndex }) {
? ? ? if (row.source === 30) {
? ? ? ? return 'redColor'
? ? ? }
? ? }
帶scoped 的 style:
.tableList {
? ? margin: 10px 30px;
? ? margin-bottom: 30px;
? ? padding-right: 30px;
? ? position: relative;
? ? :deep(.redColor) {
? ? ? color: red !important;
? ? }
? }