|
@@ -1,5 +1,5 @@
|
|
import { getCell, getColumnByCell, getRowIdentity } from './util';
|
|
import { getCell, getColumnByCell, getRowIdentity } from './util';
|
|
-import { getStyle, hasClass, addClass, removeClass } from 'element-ui/src/utils/dom';
|
|
|
|
|
|
+import { getStyle, hasClass } from 'element-ui/src/utils/dom';
|
|
import ElCheckbox from 'element-ui/packages/checkbox';
|
|
import ElCheckbox from 'element-ui/packages/checkbox';
|
|
import ElTooltip from 'element-ui/packages/tooltip';
|
|
import ElTooltip from 'element-ui/packages/tooltip';
|
|
import debounce from 'throttle-debounce/debounce';
|
|
import debounce from 'throttle-debounce/debounce';
|
|
@@ -103,42 +103,6 @@ export default {
|
|
);
|
|
);
|
|
},
|
|
},
|
|
|
|
|
|
- watch: {
|
|
|
|
- 'store.states.hoverRow'(newVal, oldVal) {
|
|
|
|
- if (!this.store.states.isComplex) return;
|
|
|
|
- const el = this.$el;
|
|
|
|
- if (!el) return;
|
|
|
|
- const tr = el.querySelector('tbody').children;
|
|
|
|
- const rows = [].filter.call(tr, row => hasClass(row, 'el-table__row'));
|
|
|
|
- const oldRow = rows[oldVal];
|
|
|
|
- const newRow = rows[newVal];
|
|
|
|
- if (oldRow) {
|
|
|
|
- removeClass(oldRow, 'hover-row');
|
|
|
|
- }
|
|
|
|
- if (newRow) {
|
|
|
|
- addClass(newRow, 'hover-row');
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- 'store.states.currentRow'(newVal, oldVal) {
|
|
|
|
- if (!this.highlight) return;
|
|
|
|
- const el = this.$el;
|
|
|
|
- if (!el) return;
|
|
|
|
- const data = this.store.states.data;
|
|
|
|
- const tr = el.querySelector('tbody').children;
|
|
|
|
- const rows = [].filter.call(tr, row => hasClass(row, 'el-table__row'));
|
|
|
|
- const oldRow = rows[data.indexOf(oldVal)];
|
|
|
|
- const newRow = rows[data.indexOf(newVal)];
|
|
|
|
- if (oldRow) {
|
|
|
|
- removeClass(oldRow, 'current-row');
|
|
|
|
- } else {
|
|
|
|
- [].forEach.call(rows, row => removeClass(row, 'current-row'));
|
|
|
|
- }
|
|
|
|
- if (newRow) {
|
|
|
|
- addClass(newRow, 'current-row');
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
computed: {
|
|
computed: {
|
|
table() {
|
|
table() {
|
|
return this.$parent;
|
|
return this.$parent;
|
|
@@ -247,6 +211,10 @@ export default {
|
|
classes.push('current-row');
|
|
classes.push('current-row');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (rowIndex === this.store.states.hoverRow) {
|
|
|
|
+ classes.push('hover-row');
|
|
|
|
+ }
|
|
|
|
+
|
|
if (this.stripe && rowIndex % 2 === 1) {
|
|
if (this.stripe && rowIndex % 2 === 1) {
|
|
classes.push('el-table__row--striped');
|
|
classes.push('el-table__row--striped');
|
|
}
|
|
}
|