fix:行destory时,hoverDom

This commit is contained in:
wanghaoo 2019-03-08 10:10:47 +08:00
parent 37b9806507
commit c0d9531a0a
4 changed files with 43 additions and 31 deletions

39
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "bee-table", "name": "bee-table",
"version": "2.0.3-beta.0", "version": "2.0.4",
"description": "Table ui component for react", "description": "Table ui component for react",
"keywords": [ "keywords": [
"react", "react",

View File

@ -320,6 +320,10 @@ class Table extends Component {
if (index !== -1) { if (index !== -1) {
expandedRows.splice(index, 1); expandedRows.splice(index, 1);
} }
//
if(this.currentHoverKey == rowKey && this.hoverDom){
this.hoverDom.style.display = 'none';
}
this.onExpandedRowsChange(expandedRows); this.onExpandedRowsChange(expandedRows);
} }
@ -1114,20 +1118,23 @@ class Table extends Component {
currentHoverKey: isHover ? key : null, currentHoverKey: isHover ? key : null,
}); });
} }
if(this.hoverDom && isHover){ if(this.hoverDom){
this.currentHoverKey = key; if(isHover){
const td = closest(event.target,'td'); this.currentHoverKey = key;
if(td){ const td = closest(event.target,'td');
const scrollTop = this.lastScrollTop ?this.lastScrollTop:0 if(td){
let top = td.offsetTop - scrollTop; const scrollTop = this.lastScrollTop ?this.lastScrollTop:0
if(this.refs.headTable){ let top = td.offsetTop - scrollTop;
top = top + this.refs.headTable.clientHeight; if(this.refs.headTable){
top = top + this.refs.headTable.clientHeight;
}
this.hoverDom.style.top = top + 'px';
this.hoverDom.style.height = td.offsetHeight + 'px';
this.hoverDom.style.lineHeight = td.offsetHeight + 'px';
this.hoverDom.style.display = 'block';
} }
this.hoverDom.style.top = top + 'px';
this.hoverDom.style.height = td.offsetHeight + 'px';
this.hoverDom.style.lineHeight = td.offsetHeight + 'px';
this.hoverDom.style.display = 'block';
} }
} }
onRowHover && onRowHover(currentIndex,record); onRowHover && onRowHover(currentIndex,record);