Commit a1bdd0d74fc8985e8111f146f88c5dd5849a0ab6
1 parent
d649c177
fix issue: #2352
Showing
1 changed file
with
4 additions
and
1 deletions
Show diff stats
src/components/table/table.vue
@@ -354,7 +354,10 @@ | @@ -354,7 +354,10 @@ | ||
354 | if (allWidth) autoWidthIndex = this.cloneColumns.findIndex(cell => !cell.width);//todo 这行可能有问题 | 354 | if (allWidth) autoWidthIndex = this.cloneColumns.findIndex(cell => !cell.width);//todo 这行可能有问题 |
355 | 355 | ||
356 | if (this.data.length) { | 356 | if (this.data.length) { |
357 | - const $td = this.$refs.tbody.$el.querySelectorAll('tbody tr')[0].children; | 357 | + const $tr = this.$refs.tbody.$el.querySelectorAll('tbody tr'); |
358 | + if ($tr.length === 0) return; | ||
359 | + const $td = $tr[0].children; | ||
360 | + | ||
358 | for (let i = 0; i < $td.length; i++) { // can not use forEach in Firefox | 361 | for (let i = 0; i < $td.length; i++) { // can not use forEach in Firefox |
359 | const column = this.cloneColumns[i]; | 362 | const column = this.cloneColumns[i]; |
360 | 363 |