Commit 5edc93d685768dc7bb41b8d69398fd24b90c1200
Committed by
GitHub
Merge pull request #2757 from adam-zou/pr/2644
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 | 354 | if (allWidth) autoWidthIndex = this.cloneColumns.findIndex(cell => !cell.width);//todo 这行可能有问题 |
355 | 355 | |
356 | 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 | 361 | for (let i = 0; i < $td.length; i++) { // can not use forEach in Firefox |
359 | 362 | const column = this.cloneColumns[i]; |
360 | 363 | ... | ... |