From e7f2801b5eff0200074e5fe144bc2d3d16f9af7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=BC=E5=95=B8=E9=9A=8F=E9=A3=8E?= Date: Tue, 9 Jan 2018 10:22:17 +0800 Subject: [PATCH] fix last column resize bug when no data If a table has heigth and last column is auto width let width = '' // is_last_column, true && top_always_true && height_set_by_user, true if ( this.columns.length === index + 1 && top && this.$parent.bodyHeight !== 0) { // width will be 0 + this.$parent.scrollBarWidth === this.$parent.scrollBarWidth // so last column will be 10~20px(the width of scrollBar) } there is an example with iview@2.8.0 [gist](https://gist.github.com/anonymous/e04e86c9e99d4d1e97bf327769acd345) [demo on jsbin](http://jsbin.com/soqogagiqu) --- src/components/table/mixin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/table/mixin.js b/src/components/table/mixin.js index 1b4a6b40..7a06e247 100644 --- a/src/components/table/mixin.js +++ b/src/components/table/mixin.js @@ -25,7 +25,7 @@ export default { width = this.columnsWidth[column._index].width; } // when browser has scrollBar,set a width to resolve scroll position bug - if (this.columns.length === index + 1 && top && this.$parent.bodyHeight !== 0) { + if (width && this.columns.length === index + 1 && top && this.$parent.bodyHeight !== 0) { width += this.$parent.scrollBarWidth; } // when fixed type,reset first right fixed column's width