diff --git a/examples/routers/table.vue b/examples/routers/table.vue index 6affa62f..570734fd 100644 --- a/examples/routers/table.vue +++ b/examples/routers/table.vue @@ -1,7 +1,7 @@ - - + + @@ -10,18 +10,67 @@ - - + + - + + + + 修改Sider绑定的变量来控制收缩 + + + + + + + 文章管理 + + + + 评论管理 + + + + + + 用户留存 + + + + 流失用户 + + + + + + + 菜单 + + + + + + + + + \ No newline at end of file diff --git a/src/components/table/table.vue b/src/components/table/table.vue index f0986523..38cbecee 100644 --- a/src/components/table/table.vue +++ b/src/components/table/table.vue @@ -566,19 +566,18 @@ const headerHeight = parseInt(getStyle(this.$refs.header, 'height')) || 0; const footerHeight = parseInt(getStyle(this.$refs.footer, 'height')) || 0; this.bodyHeight = this.height - titleHeight - headerHeight - footerHeight; - this.fixedBody(); + this.$nextTick(()=>this.fixedBody()); }); } else { this.bodyHeight = 0; - this.fixedBody(); + this.$nextTick(()=>this.fixedBody()); } }, fixedBody (){ if (this.$refs.header) { this.headerWidth = this.$refs.header.children[0].offsetWidth; this.headerHeight = this.$refs.header.children[0].offsetHeight; - this.showHorizontalScrollBar = this.headerWidth>this.$refs.header.offsetWidth; - + //this.showHorizontalScrollBar = this.headerWidth>this.$refs.header.offsetWidth; } if (!this.$refs.tbody || !this.data || this.data.length === 0) { @@ -590,10 +589,7 @@ let bodyContentHeight = bodyContentEl.offsetHeight; let bodyHeight = bodyEl.offsetHeight; - if (!this.$refs.header) { - this.showHorizontalScrollBar = bodyEl.offsetWidth < bodyContentEl.offsetWidth + (this.showVerticalScrollBar?this.scrollBarWidth:0); - } - + this.showHorizontalScrollBar = bodyEl.offsetWidth < bodyContentEl.offsetWidth + (this.showVerticalScrollBar?this.scrollBarWidth:0); this.showVerticalScrollBar = this.bodyHeight? bodyHeight - (this.showHorizontalScrollBar?this.scrollBarWidth:0) < bodyContentHeight : false; if(this.showVerticalScrollBar){