mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-21 01:02:59 +08:00
fix(components): [el-table] avoid scrollbar not display (#5920)
* fix(components): [el-table] avoid scrollbar not display * chore: optimize code
This commit is contained in:
parent
dcb7365365
commit
43c41015eb
@ -115,7 +115,6 @@ export default defineComponent({
|
||||
|
||||
const update = () => {
|
||||
if (!wrap$.value) return
|
||||
|
||||
const offsetHeight = wrap$.value.offsetHeight - GAP
|
||||
const offsetWidth = wrap$.value.offsetWidth - GAP
|
||||
|
||||
@ -151,6 +150,19 @@ export default defineComponent({
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
watch(
|
||||
() => [props.maxHeight, props.height],
|
||||
() => {
|
||||
if (!props.native)
|
||||
nextTick(() => {
|
||||
update()
|
||||
if (wrap$.value) {
|
||||
barRef.value?.handleScroll(wrap$.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
provide(
|
||||
scrollbarContextKey,
|
||||
reactive({
|
||||
|
@ -137,12 +137,17 @@ class TableLayout<T> {
|
||||
updateElsHeight() {
|
||||
if (!this.table.$ready) return nextTick(() => this.updateElsHeight())
|
||||
const {
|
||||
tableWrapper,
|
||||
headerWrapper,
|
||||
appendWrapper,
|
||||
footerWrapper,
|
||||
tableHeader,
|
||||
tableBody,
|
||||
} = this.table.refs
|
||||
if (tableWrapper && tableWrapper.style.display === 'none') {
|
||||
// avoid v-show
|
||||
return
|
||||
}
|
||||
this.appendHeight.value = appendWrapper ? appendWrapper.offsetHeight : 0
|
||||
if (this.showHeader && !headerWrapper) return
|
||||
const headerTrElm: HTMLElement = tableHeader ? tableHeader : null
|
||||
|
Loading…
Reference in New Issue
Block a user