fix(components): [el-table] cannot scroll when tableLayout is auto (#6790)

* fix(components): [el-table] cannot scroll when tableLayout is auto

* chore: improve code
This commit is contained in:
msidolphin
2022-03-24 15:20:55 +08:00
committed by GitHub
parent 7b61eba9f3
commit 2759ecf5b2

View File

@@ -148,18 +148,21 @@ class TableLayout<T> {
// avoid v-show
return
}
const { tableLayout } = this.table.props
this.appendHeight.value = appendWrapper ? appendWrapper.offsetHeight : 0
if (this.showHeader && !headerWrapper) return
if (this.showHeader && !headerWrapper && tableLayout === 'fixed') {
return
}
const headerTrElm: HTMLElement = tableHeader ? tableHeader : null
const noneHeader = this.headerDisplayNone(headerTrElm)
const headerWrapperOffsetHeight = headerWrapper?.offsetHeight || 0
const headerHeight = (this.headerHeight.value = !this.showHeader
? 0
: headerWrapper.offsetHeight)
: headerWrapperOffsetHeight)
if (
this.showHeader &&
!noneHeader &&
headerWrapper.offsetWidth > 0 &&
headerWrapperOffsetHeight > 0 &&
(this.table.store.states.columns.value || []).length > 0 &&
headerHeight < 2
) {