mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-27 02:01:15 +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 = () => {
|
const update = () => {
|
||||||
if (!wrap$.value) return
|
if (!wrap$.value) return
|
||||||
|
|
||||||
const offsetHeight = wrap$.value.offsetHeight - GAP
|
const offsetHeight = wrap$.value.offsetHeight - GAP
|
||||||
const offsetWidth = wrap$.value.offsetWidth - GAP
|
const offsetWidth = wrap$.value.offsetWidth - GAP
|
||||||
|
|
||||||
@ -151,6 +150,19 @@ export default defineComponent({
|
|||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => [props.maxHeight, props.height],
|
||||||
|
() => {
|
||||||
|
if (!props.native)
|
||||||
|
nextTick(() => {
|
||||||
|
update()
|
||||||
|
if (wrap$.value) {
|
||||||
|
barRef.value?.handleScroll(wrap$.value)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
provide(
|
provide(
|
||||||
scrollbarContextKey,
|
scrollbarContextKey,
|
||||||
reactive({
|
reactive({
|
||||||
|
@ -137,12 +137,17 @@ class TableLayout<T> {
|
|||||||
updateElsHeight() {
|
updateElsHeight() {
|
||||||
if (!this.table.$ready) return nextTick(() => this.updateElsHeight())
|
if (!this.table.$ready) return nextTick(() => this.updateElsHeight())
|
||||||
const {
|
const {
|
||||||
|
tableWrapper,
|
||||||
headerWrapper,
|
headerWrapper,
|
||||||
appendWrapper,
|
appendWrapper,
|
||||||
footerWrapper,
|
footerWrapper,
|
||||||
tableHeader,
|
tableHeader,
|
||||||
tableBody,
|
tableBody,
|
||||||
} = this.table.refs
|
} = this.table.refs
|
||||||
|
if (tableWrapper && tableWrapper.style.display === 'none') {
|
||||||
|
// avoid v-show
|
||||||
|
return
|
||||||
|
}
|
||||||
this.appendHeight.value = appendWrapper ? appendWrapper.offsetHeight : 0
|
this.appendHeight.value = appendWrapper ? appendWrapper.offsetHeight : 0
|
||||||
if (this.showHeader && !headerWrapper) return
|
if (this.showHeader && !headerWrapper) return
|
||||||
const headerTrElm: HTMLElement = tableHeader ? tableHeader : null
|
const headerTrElm: HTMLElement = tableHeader ? tableHeader : null
|
||||||
|
Loading…
Reference in New Issue
Block a user