Commit 95e1720ce3c454be058304e1a797fa6f42a9bee7

Authored by huanghong
1 parent 8744e122

fix ivu-table-fixed bug

examples/routers/table.vue
... ... @@ -11,6 +11,12 @@
11 11 <div style='margin:20px 0px'>
12 12 <Table :height='200' border :columns="columns2" :data="data3"></Table>
13 13 </div>
  14 + <div style='margin:20px 0px'>
  15 + <Table :width='500' border :columns="columns2" :data="data3"></Table>
  16 + </div>
  17 + <div style='margin:20px 0px'>
  18 + <Table :width='500' :height='200' border :columns="columns2" :data="data3"></Table>
  19 + </div>
14 20 <div style='margin:20px 0px;'>
15 21 <Table :data="tableData1" :columns="tableColumns1" :height='500' stripe size='small'></Table>
16 22 <div style="margin: 10px;overflow: hidden">
... ...
src/components/table/mixin.js
... ... @@ -25,7 +25,10 @@ export default {
25 25 width = this.columnsWidth[column._index].width;
26 26 }
27 27 // when browser has scrollBar,set a width to resolve scroll position bug
28   - if (width && this.columns.length === index + 1 && top && this.$parent.bodyHeight !== 0) {
  28 + if(this.columns.length==7 && column.fixed){
  29 + console.log(column);
  30 + }
  31 + if (width && this.columns.length === index + 1 && top && this.$parent.bodyHeight !== 0 && column.fixed!=='left' && !this.fixed) {
29 32 let scrollBarWidth = this.$parent.scrollBarWidth;
30 33 if (!this.$parent.showVerticalScrollBar) scrollBarWidth = 0;
31 34 width += scrollBarWidth;
... ...
src/components/table/table-head.vue
... ... @@ -87,6 +87,9 @@
87 87 const style = Object.assign({}, this.styleObject);
88 88 let scrollBarWidth = this.$parent.scrollBarWidth;
89 89 if(!this.$parent.showVerticalScrollBar) scrollBarWidth = 0;
  90 +
  91 + let isLeftFixed = this.$el && this.$el.parentElement.className.indexOf('fixed-header')>0;
  92 + if(isLeftFixed) scrollBarWidth = 0;
90 93 const width = this.$parent.bodyHeight === 0 ? parseInt(this.styleObject.width) : parseInt(this.styleObject.width) + scrollBarWidth;
91 94 style.width = `${width}px`;
92 95 return style;
... ...
src/components/table/table.vue
... ... @@ -314,7 +314,7 @@
314 314 if (col.fixed && col.fixed === 'left') {
315 315 left.push(col);
316 316 } else {
317   - other.push(col);
  317 + //other.push(col);
318 318 }
319 319 });
320 320 return left.concat(other);
... ... @@ -326,7 +326,7 @@
326 326 if (col.fixed && col.fixed === 'right') {
327 327 right.push(col);
328 328 } else {
329   - other.push(col);
  329 + //other.push(col);
330 330 }
331 331 });
332 332 return right.concat(other);
... ...