Commit a404bbaed33d567ed1de2576059c68e6ff5ed2af
1 parent
3d6fa54b
update Table #167
update Table
Showing
3 changed files
with
11 additions
and
3 deletions
Show diff stats
src/components/table/mixin.js
@@ -19,7 +19,7 @@ export default { | @@ -19,7 +19,7 @@ export default { | ||
19 | width = this.columnsWidth[column._index].width; | 19 | width = this.columnsWidth[column._index].width; |
20 | } | 20 | } |
21 | // when browser has scrollBar,set a width to resolve scroll position bug | 21 | // when browser has scrollBar,set a width to resolve scroll position bug |
22 | - if (this.columns.length === index + 1 && top) { | 22 | + if (this.columns.length === index + 1 && top && this.$parent.bodyHeight !== 0) { |
23 | width += this.$parent.scrollBarWidth; | 23 | width += this.$parent.scrollBarWidth; |
24 | } | 24 | } |
25 | // when fixed type,reset first right fixed column's width | 25 | // when fixed type,reset first right fixed column's width |
src/components/table/table-head.vue
1 | <template> | 1 | <template> |
2 | - <table cellspacing="0" cellpadding="0" border="0" :style="style"> | 2 | + <table cellspacing="0" cellpadding="0" border="0" :style="styles"> |
3 | <colgroup> | 3 | <colgroup> |
4 | <col v-for="column in columns" :width="setCellWidth(column, $index, true)"> | 4 | <col v-for="column in columns" :width="setCellWidth(column, $index, true)"> |
5 | </colgroup> | 5 | </colgroup> |
@@ -75,6 +75,12 @@ | @@ -75,6 +75,12 @@ | ||
75 | } | 75 | } |
76 | }, | 76 | }, |
77 | computed: { | 77 | computed: { |
78 | + styles () { | ||
79 | + const style = Object.assign({}, this.style); | ||
80 | + const width = this.$parent.bodyHeight === 0 ? parseInt(this.style.width) : parseInt(this.style.width) + this.$parent.scrollBarWidth; | ||
81 | + style.width = `${width}px`; | ||
82 | + return style; | ||
83 | + }, | ||
78 | isSelectAll () { | 84 | isSelectAll () { |
79 | let isSelectAll = true; | 85 | let isSelectAll = true; |
80 | if (!this.data.length) isSelectAll = false; | 86 | if (!this.data.length) isSelectAll = false; |
test/routers/table.vue
@@ -4,7 +4,9 @@ | @@ -4,7 +4,9 @@ | ||
4 | } | 4 | } |
5 | </style> | 5 | </style> |
6 | <template> | 6 | <template> |
7 | - <i-table width="550" height="200" border :columns="columns2" :data="data4"></i-table> | 7 | + <i-table border :columns="columns1" :data="data1"></i-table> |
8 | + <i-table border height="200" :columns="columns1" :data="data2"></i-table> | ||
9 | + <!--<i-table width="550" height="200" border :columns="columns2" :data="data4"></i-table>--> | ||
8 | <!--<i-button @click="changeFilter">改变filter</i-button>--> | 10 | <!--<i-button @click="changeFilter">改变filter</i-button>--> |
9 | <!--<span v-if="currentRow !== null">Current Row: {{currentRow.name}}</span>--> | 11 | <!--<span v-if="currentRow !== null">Current Row: {{currentRow.name}}</span>--> |
10 | <!--<Switch size="small" @on-change="switchCellEllipsis"></Switch> Ellipsis--> | 12 | <!--<Switch size="small" @on-change="switchCellEllipsis"></Switch> Ellipsis--> |