From 5bc8813fe63aded7ca9cfc4860eee868d6996289 Mon Sep 17 00:00:00 2001 From: wanghaoo Date: Wed, 28 Nov 2018 11:52:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=96=E6=8B=BD=E6=BF=80=E6=B4=BB=E5=8C=BA?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6=E8=B6=85=E9=95=BF=E5=AF=BC=E8=87=B4=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E6=9D=A1=E6=98=BE=E7=A4=BAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/ColumnManager.js | 2 +- build/Table.css | 2 ++ build/Table.js | 2 +- src/ColumnManager.js | 2 +- src/Table.js | 4 ++-- src/Table.scss | 6 +++++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/build/ColumnManager.js b/build/ColumnManager.js index ec72884..8bdf7da 100644 --- a/build/ColumnManager.js +++ b/build/ColumnManager.js @@ -215,7 +215,7 @@ var ColumnManager = function () { ColumnManager.prototype.getColumnWidth = function getColumnWidth(contentWidth) { var columns = this.leafColumns(); - var res = { computeWidth: 0, lastShowIndex: 0 }; + var res = { computeWidth: 0, lastShowIndex: -1 }; columns.forEach(function (col, index) { //如果列显示 if (col.ifshow) { diff --git a/build/Table.css b/build/Table.css index eb4a19e..3dbfffd 100644 --- a/build/Table.css +++ b/build/Table.css @@ -192,6 +192,8 @@ .u-table td { padding: 12px 8px; word-break: break-all; } + .u-table tr th:last-child { + overflow: hidden; } .u-table-row-hover { background: #e3f2fd; } .u-table-scroll { diff --git a/build/Table.js b/build/Table.js index 00c78b5..565ef54 100644 --- a/build/Table.js +++ b/build/Table.js @@ -437,7 +437,7 @@ var Table = function (_Component) { _state$contentWidthDi = _state.contentWidthDiff, contentWidthDiff = _state$contentWidthDi === undefined ? 0 : _state$contentWidthDi, _state$lastShowIndex = _state.lastShowIndex, - lastShowIndex = _state$lastShowIndex === undefined ? 0 : _state$lastShowIndex; + lastShowIndex = _state$lastShowIndex === undefined ? -1 : _state$lastShowIndex; var filterCol = []; rows = rows || []; diff --git a/src/ColumnManager.js b/src/ColumnManager.js index 04f69bf..eeb8534 100644 --- a/src/ColumnManager.js +++ b/src/ColumnManager.js @@ -160,7 +160,7 @@ export default class ColumnManager { } getColumnWidth(contentWidth){ let columns = this.leafColumns(); - let res={computeWidth:0,lastShowIndex:0}; + let res={computeWidth:0,lastShowIndex:-1}; columns.forEach((col,index)=>{ //如果列显示 if(col.ifshow){ diff --git a/src/Table.js b/src/Table.js index 8808552..489b3ba 100644 --- a/src/Table.js +++ b/src/Table.js @@ -341,7 +341,7 @@ class Table extends Component { } getHeaderRows(columns, currentRow = 0, rows) { - let { contentWidthDiff = 0, lastShowIndex = 0 } = this.state; + let { contentWidthDiff = 0, lastShowIndex = -1 } = this.state; let filterCol = []; rows = rows || []; rows[currentRow] = rows[currentRow] || []; @@ -691,7 +691,7 @@ class Table extends Component { }else{ //内容少,不用显示滚动条 if(this.domWidthDiff > 0){ - headStyle.overflowX = 'auto'; + headStyle.overflowX = 'hidden'; } headStyle.marginBottom = `0px`; } diff --git a/src/Table.scss b/src/Table.scss index 5d09157..1018293 100644 --- a/src/Table.scss +++ b/src/Table.scss @@ -73,7 +73,11 @@ $table-move-in-color: $bg-color-base; padding: $vertical-padding $horizontal-padding; word-break: break-all; } - + tr { + th:last-child{ //拖拽tag影响了表格整体宽度 + overflow: hidden; + } + } &-row-hover { background: rgb(227, 242, 253); }