Commit b1262a3d8d0804b3afed70952453a7030494b461
1 parent
9f75c487
fixed no data width calculation
Showing
1 changed file
with
2 additions
and
3 deletions
Show diff stats
src/components/table/table.vue
... | ... | @@ -570,9 +570,8 @@ |
570 | 570 | this.headerWidth = this.$refs.header.childNodes[0].offsetWidth; |
571 | 571 | this.headerHeight = this.$refs.header.childNodes[0].offsetHeight; |
572 | 572 | this.showHorizontalScrollBar = this.headerWidth>this.$refs.header.parentElement.offsetWidth; |
573 | - if (!this.$refs.tbody) { | |
573 | + if (!this.$refs.tbody || !this.data || this.data.length === 0) { | |
574 | 574 | this.showVerticalScrollBar = false; |
575 | - return; | |
576 | 575 | } |
577 | 576 | else{ |
578 | 577 | let bodyContentEl = this.$refs.tbody.$el; |
... | ... | @@ -592,8 +591,8 @@ |
592 | 591 | }else{ |
593 | 592 | bodyEl.classList.remove(this.prefixCls +'-overflowX'); |
594 | 593 | } |
595 | - this.tableWidth = this.cloneColumns.map(cell => cell._width).reduce((a, b) => a + b, 0) + (this.showVerticalScrollBar?this.scrollBarWidth:0); | |
596 | 594 | } |
595 | + this.tableWidth = this.cloneColumns.map(cell => cell._width).reduce((a, b) => a + b, 0) + (this.showVerticalScrollBar?this.scrollBarWidth:0); | |
597 | 596 | }, |
598 | 597 | |
599 | 598 | hideColumnFilter () { | ... | ... |