Commit 5257b1ed authored by 杨奕's avatar 杨奕 Committed by Cyril Su

Table: fix wrong stripe style with expandable rows (#4873)

parent b124944d
......@@ -14,6 +14,7 @@ export default {
store: {
required: true
},
stripe: Boolean,
context: {},
layout: {
required: true
......@@ -52,7 +53,7 @@ export default {
on-contextmenu={ ($event) => this.handleContextMenu($event, row) }
on-mouseenter={ _ => this.handleMouseEnter($index) }
on-mouseleave={ _ => this.handleMouseLeave() }
class={ ['el-table__row', this.getRowClass(row, $index)] }>
class={ [this.getRowClass(row, $index)] }>
{
this._l(this.columns, (column, cellIndex) =>
<td
......@@ -186,8 +187,11 @@ export default {
},
getRowClass(row, index) {
const classes = [];
const classes = ['el-table__row'];
if (this.stripe && index % 2 === 1) {
classes.push('el-table__row--striped');
}
const rowClassName = this.rowClassName;
if (typeof rowClassName === 'string') {
classes.push(rowClassName);
......
......@@ -26,6 +26,7 @@
<table-body
:context="context"
:store="store"
:stripe="stripe"
:layout="layout"
:row-class-name="rowClassName"
:row-style="rowStyle"
......@@ -69,6 +70,7 @@
<table-body
fixed="left"
:store="store"
:stripe="stripe"
:layout="layout"
:highlight="highlightCurrentRow"
:row-class-name="rowClassName"
......@@ -110,6 +112,7 @@
<table-body
fixed="right"
:store="store"
:stripe="stripe"
:layout="layout"
:row-class-name="rowClassName"
:row-style="rowStyle"
......
......@@ -386,7 +386,7 @@
@modifier striped {
& .el-table__body {
& tr:nth-child(2n) {
& tr.el-table__row--striped {
td {
background: #FAFAFA;
background-clip: padding-box;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment