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
src/components/table/table-head.vue
| ... | ... | @@ -57,16 +57,6 @@ |
| 57 | 57 | selectAll () { |
| 58 | 58 | const status = !this.isSelectAll; |
| 59 | 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 | 179 | this.columnsWidth = []; |
| 180 | 180 | let autoWidthIndex = -1; |
| 181 | 181 | if (allWidth) autoWidthIndex = this.cloneColumns.findIndex(cell => !cell.width); |
| 182 | + console.log(1) | |
| 182 | 183 | |
| 183 | 184 | const $td = this.$refs.tbody.$el.querySelectorAll('tbody tr')[0].querySelectorAll('td'); |
| 184 | 185 | for (let i = 0; i < $td.length; i++) { // can not use forEach in Firefox |
| ... | ... | @@ -328,6 +329,7 @@ |
| 328 | 329 | }, |
| 329 | 330 | columns: { |
| 330 | 331 | handler () { |
| 332 | + this.cloneColumns = deepCopy(this.columns); | |
| 331 | 333 | this.parseColumns(); |
| 332 | 334 | this.handleResize(); |
| 333 | 335 | }, | ... | ... |
test/routers/table.vue
| ... | ... | @@ -74,7 +74,7 @@ |
| 74 | 74 | title: '操作', |
| 75 | 75 | key: 'action', |
| 76 | 76 | fixed: 'right', |
| 77 | - width: 200, | |
| 77 | + width: 120, | |
| 78 | 78 | render (row, column, index) { |
| 79 | 79 | return `<i-button @click="edit(${index})">${row.name}</i-button>` |
| 80 | 80 | // return `<a>${row.name}</a>` |
| ... | ... | @@ -145,6 +145,8 @@ |
| 145 | 145 | }, |
| 146 | 146 | ready () { |
| 147 | 147 | setTimeout(() => { |
| 148 | +// this.columns[3].width = 300; | |
| 149 | +// this.columns[2].width = 150; | |
| 148 | 150 | // return; |
| 149 | 151 | // this.height = 150; |
| 150 | 152 | // return |
| ... | ... | @@ -155,7 +157,7 @@ |
| 155 | 157 | // edit: false |
| 156 | 158 | // }); |
| 157 | 159 | // this.data.splice(1, 1) |
| 158 | - }, 1000); | |
| 160 | + }, 2000); | |
| 159 | 161 | } |
| 160 | 162 | } |
| 161 | 163 | </script> |
| 162 | 164 | \ No newline at end of file | ... | ... |