calc active tab from router param when using primevue tabsview

This commit is contained in:
Harald Bamberger
2025-06-23 17:31:43 +02:00
parent ae10ac877f
commit ce8f0843cc
+10
View File
@@ -50,6 +50,15 @@ export default {
set(v) {
this.$emit('update:modelValue', v);
}
},
calcActiveIndex: function() {
let keys = Object.keys(this.tabs);
let index = keys.indexOf(this.default);
if( index === -1 ) {
return 0;
} else {
return index;
}
}
},
watch: {
@@ -120,6 +129,7 @@ export default {
<tabview
:scrollable="true"
:lazy="true"
:activeIndex="calcActiveIndex"
@tab-click="handleTabClick"
>
<tabpanel