level 2 collapse

This commit is contained in:
Henry Jameson 2025-11-20 18:29:09 +02:00
commit 8e6800fd1e
6 changed files with 42 additions and 3 deletions

View file

@ -32,6 +32,11 @@ export default {
required: false,
type: Boolean,
default: false
},
parentCollapsed: {
required: false,
type: Boolean,
default: false
}
},
emits: ['tooBig', 'tooSmall'],
@ -91,11 +96,18 @@ export default {
const navWidth = this.$refs.nav?.clientWidth
const contentsWidth = this.$refs.contents?.clientWidth
if (contentsWidth < tabContentWidth) {
this.$emit('tooSmall')
if (this.parentCollapsed) {
this.hideNav()
} else {
this.$emit('tooSmall')
}
} else if (contentsWidth - navWidth >= tabContentWidth){
this.$emit('tooBig')
if (this.parentCollapsed) {
this.$emit('tooBig')
} else {
this.showNav()
}
}
},
// DO NOT put it to computed, it doesn't work (caching?)

View file

@ -26,6 +26,10 @@
flex: 1 1 auto;
overflow-x: hidden;
.tab-content-label {
display: none
}
.tab-content {
align-self: center;
@ -77,6 +81,14 @@
}
&.-nav-content {
> .contents {
> .tab-content-wrapper {
> .tab-content-label {
display: block;
}
}
}
> .tabs {
position: absolute;
pointer-events: none;