fix logic not working on other tabs

This commit is contained in:
Henry Jameson 2025-11-20 22:06:02 +02:00
commit 9572b9704c

View file

@ -121,6 +121,7 @@ export default {
if (this.navSide !== side) { if (this.navSide !== side) {
this.navSide = side this.navSide = side
this.$emit('sideSwitch', side) this.$emit('sideSwitch', side)
this.onResize()
} }
}, },
getNavMode () { getNavMode () {
@ -128,11 +129,13 @@ export default {
}, },
onResize () { onResize () {
// All other tabs are hidden and their width is most likely 0 // All other tabs are hidden and their width is most likely 0
const tabContent = this.$refs.contents.querySelector('.tab-content-wrapper.-active .tab-content') const activeTab = this.$refs.root.querySelector('.tab-content-wrapper.-active')
const tabContent = activeTab.querySelector('.tab-content')
const tabContentWidth = tabContent.clientWidth const tabContentWidth = tabContent.clientWidth
const rootWidth = this.$refs.root.clientWidth
const navWidth = this.$refs.nav.clientWidth const navWidth = this.$refs.nav.clientWidth
const contentsWidth = this.$refs.contents.clientWidth const contentsWidth = rootWidth - navWidth
// if contents takes more space than its container // if contents takes more space than its container
if (contentsWidth < tabContentWidth) { if (contentsWidth < tabContentWidth) {
@ -141,6 +144,7 @@ export default {
} else { } else {
this.$emit('tooSmall') this.$emit('tooSmall')
} }
// FIXME wrong again??
// If we (theoretically) have enough space to fit it in // If we (theoretically) have enough space to fit it in
} else if (contentsWidth - navWidth >= tabContentWidth){ } else if (contentsWidth - navWidth >= tabContentWidth){
// First expand the inner layer, then outer // First expand the inner layer, then outer
@ -205,7 +209,6 @@ export default {
const headerClasses = ['tab-content-label'] const headerClasses = ['tab-content-label']
if (this.hideHeader === true) { if (this.hideHeader === true) {
console.log('A', this.hideHeader)
headerClasses.push('-hidden') headerClasses.push('-hidden')
} }
const header = ( const header = (