mirror of https://github.com/ElemeFE/element
Table: fix wrong stripe style with expandable rows (#4873)
parent
b124944dd8
commit
5257b1ede8
|
@ -14,6 +14,7 @@ export default {
|
||||||
store: {
|
store: {
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
stripe: Boolean,
|
||||||
context: {},
|
context: {},
|
||||||
layout: {
|
layout: {
|
||||||
required: true
|
required: true
|
||||||
|
@ -52,7 +53,7 @@ export default {
|
||||||
on-contextmenu={ ($event) => this.handleContextMenu($event, row) }
|
on-contextmenu={ ($event) => this.handleContextMenu($event, row) }
|
||||||
on-mouseenter={ _ => this.handleMouseEnter($index) }
|
on-mouseenter={ _ => this.handleMouseEnter($index) }
|
||||||
on-mouseleave={ _ => this.handleMouseLeave() }
|
on-mouseleave={ _ => this.handleMouseLeave() }
|
||||||
class={ ['el-table__row', this.getRowClass(row, $index)] }>
|
class={ [this.getRowClass(row, $index)] }>
|
||||||
{
|
{
|
||||||
this._l(this.columns, (column, cellIndex) =>
|
this._l(this.columns, (column, cellIndex) =>
|
||||||
<td
|
<td
|
||||||
|
@ -186,8 +187,11 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
getRowClass(row, index) {
|
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;
|
const rowClassName = this.rowClassName;
|
||||||
if (typeof rowClassName === 'string') {
|
if (typeof rowClassName === 'string') {
|
||||||
classes.push(rowClassName);
|
classes.push(rowClassName);
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
<table-body
|
<table-body
|
||||||
:context="context"
|
:context="context"
|
||||||
:store="store"
|
:store="store"
|
||||||
|
:stripe="stripe"
|
||||||
:layout="layout"
|
:layout="layout"
|
||||||
:row-class-name="rowClassName"
|
:row-class-name="rowClassName"
|
||||||
:row-style="rowStyle"
|
:row-style="rowStyle"
|
||||||
|
@ -69,6 +70,7 @@
|
||||||
<table-body
|
<table-body
|
||||||
fixed="left"
|
fixed="left"
|
||||||
:store="store"
|
:store="store"
|
||||||
|
:stripe="stripe"
|
||||||
:layout="layout"
|
:layout="layout"
|
||||||
:highlight="highlightCurrentRow"
|
:highlight="highlightCurrentRow"
|
||||||
:row-class-name="rowClassName"
|
:row-class-name="rowClassName"
|
||||||
|
@ -110,6 +112,7 @@
|
||||||
<table-body
|
<table-body
|
||||||
fixed="right"
|
fixed="right"
|
||||||
:store="store"
|
:store="store"
|
||||||
|
:stripe="stripe"
|
||||||
:layout="layout"
|
:layout="layout"
|
||||||
:row-class-name="rowClassName"
|
:row-class-name="rowClassName"
|
||||||
:row-style="rowStyle"
|
:row-style="rowStyle"
|
||||||
|
|
|
@ -386,7 +386,7 @@
|
||||||
|
|
||||||
@modifier striped {
|
@modifier striped {
|
||||||
& .el-table__body {
|
& .el-table__body {
|
||||||
& tr:nth-child(2n) {
|
& tr.el-table__row--striped {
|
||||||
td {
|
td {
|
||||||
background: #FAFAFA;
|
background: #FAFAFA;
|
||||||
background-clip: padding-box;
|
background-clip: padding-box;
|
||||||
|
|
Loading…
Reference in New Issue