diff --git a/packages/table/src/table-body.js b/packages/table/src/table-body.js index bb80307888d..098b7ba2c9f 100644 --- a/packages/table/src/table-body.js +++ b/packages/table/src/table-body.js @@ -32,6 +32,7 @@ export default { this.handleClick($event, row) } on-mouseenter={ _ => this.handleMouseEnter($index) } + on-mouseleave={ _ => this.handleMouseLeave() } class={ this.getRowClass(row, $index) }> { this._l(this.columns, (column, cellIndex) => @@ -145,6 +146,10 @@ export default { this.store.commit('setHoverRow', index); }, + handleMouseLeave() { + this.store.commit('setHoverRow', null); + }, + handleClick(event, row) { const table = this.$parent; const cell = getCell(event); diff --git a/packages/theme-default/src/table.css b/packages/theme-default/src/table.css index b69cde1331f..19b09356a1e 100644 --- a/packages/theme-default/src/table.css +++ b/packages/theme-default/src/table.css @@ -322,8 +322,12 @@ } @e body { - tr { - transition: background-color .25s ease-in-out; + td { + transition: background-color .25s ease; + } + + tr.hover-row td { + background-color: #eff2f7; } tr.current-row { @@ -359,7 +363,3 @@ } } } - -.el-table .el-table__body tr.hover-row { - background-color: #eff2f7; -}