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); }