Commit 340681ab500720cd441066b838c31db7f03eb4a5
1 parent
39947c14
update Table
update Table
Showing
4 changed files
with
6 additions
and
13 deletions
Show diff stats
src/components/table/table-body.vue
| @@ -47,7 +47,6 @@ | @@ -47,7 +47,6 @@ | ||
| 47 | [`${this.prefixCls}-row-highlight`]: this.cloneData[index] && this.cloneData[index]._isHighlight, | 47 | [`${this.prefixCls}-row-highlight`]: this.cloneData[index] && this.cloneData[index]._isHighlight, |
| 48 | [`${this.prefixCls}-row-hover`]: this.cloneData[index] && this.cloneData[index]._isHover | 48 | [`${this.prefixCls}-row-hover`]: this.cloneData[index] && this.cloneData[index]._isHover |
| 49 | } | 49 | } |
| 50 | - | ||
| 51 | ] | 50 | ] |
| 52 | }, | 51 | }, |
| 53 | setCellWidth (column, index) { | 52 | setCellWidth (column, index) { |
src/components/table/table-head.vue
| @@ -57,16 +57,6 @@ | @@ -57,16 +57,6 @@ | ||
| 57 | selectAll () { | 57 | selectAll () { |
| 58 | const status = !this.isSelectAll; | 58 | const status = !this.isSelectAll; |
| 59 | this.$parent.selectAll(status); | 59 | this.$parent.selectAll(status); |
| 60 | - | ||
| 61 | -// let tmpData = deepCopy(this.cloneData); | ||
| 62 | -// tmpData.forEach((data) => { | ||
| 63 | -// data._isChecked = status; | ||
| 64 | -// }); | ||
| 65 | -// this.cloneData = tmpData; | ||
| 66 | -// | ||
| 67 | -// if (status) { | ||
| 68 | -// this.$parent.selectAll(); | ||
| 69 | -// } | ||
| 70 | } | 60 | } |
| 71 | } | 61 | } |
| 72 | } | 62 | } |
src/components/table/table.vue
| @@ -179,6 +179,7 @@ | @@ -179,6 +179,7 @@ | ||
| 179 | this.columnsWidth = []; | 179 | this.columnsWidth = []; |
| 180 | let autoWidthIndex = -1; | 180 | let autoWidthIndex = -1; |
| 181 | if (allWidth) autoWidthIndex = this.cloneColumns.findIndex(cell => !cell.width); | 181 | if (allWidth) autoWidthIndex = this.cloneColumns.findIndex(cell => !cell.width); |
| 182 | + console.log(1) | ||
| 182 | 183 | ||
| 183 | const $td = this.$refs.tbody.$el.querySelectorAll('tbody tr')[0].querySelectorAll('td'); | 184 | const $td = this.$refs.tbody.$el.querySelectorAll('tbody tr')[0].querySelectorAll('td'); |
| 184 | for (let i = 0; i < $td.length; i++) { // can not use forEach in Firefox | 185 | for (let i = 0; i < $td.length; i++) { // can not use forEach in Firefox |
| @@ -328,6 +329,7 @@ | @@ -328,6 +329,7 @@ | ||
| 328 | }, | 329 | }, |
| 329 | columns: { | 330 | columns: { |
| 330 | handler () { | 331 | handler () { |
| 332 | + this.cloneColumns = deepCopy(this.columns); | ||
| 331 | this.parseColumns(); | 333 | this.parseColumns(); |
| 332 | this.handleResize(); | 334 | this.handleResize(); |
| 333 | }, | 335 | }, |
test/routers/table.vue
| @@ -74,7 +74,7 @@ | @@ -74,7 +74,7 @@ | ||
| 74 | title: '操作', | 74 | title: '操作', |
| 75 | key: 'action', | 75 | key: 'action', |
| 76 | fixed: 'right', | 76 | fixed: 'right', |
| 77 | - width: 200, | 77 | + width: 120, |
| 78 | render (row, column, index) { | 78 | render (row, column, index) { |
| 79 | return `<i-button @click="edit(${index})">${row.name}</i-button>` | 79 | return `<i-button @click="edit(${index})">${row.name}</i-button>` |
| 80 | // return `<a>${row.name}</a>` | 80 | // return `<a>${row.name}</a>` |
| @@ -145,6 +145,8 @@ | @@ -145,6 +145,8 @@ | ||
| 145 | }, | 145 | }, |
| 146 | ready () { | 146 | ready () { |
| 147 | setTimeout(() => { | 147 | setTimeout(() => { |
| 148 | +// this.columns[3].width = 300; | ||
| 149 | +// this.columns[2].width = 150; | ||
| 148 | // return; | 150 | // return; |
| 149 | // this.height = 150; | 151 | // this.height = 150; |
| 150 | // return | 152 | // return |
| @@ -155,7 +157,7 @@ | @@ -155,7 +157,7 @@ | ||
| 155 | // edit: false | 157 | // edit: false |
| 156 | // }); | 158 | // }); |
| 157 | // this.data.splice(1, 1) | 159 | // this.data.splice(1, 1) |
| 158 | - }, 1000); | 160 | + }, 2000); |
| 159 | } | 161 | } |
| 160 | } | 162 | } |
| 161 | </script> | 163 | </script> |
| 162 | \ No newline at end of file | 164 | \ No newline at end of file |