Commit 95e1720ce3c454be058304e1a797fa6f42a9bee7

Authored by huanghong
1 parent 8744e122

fix ivu-table-fixed bug

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