fix(encounter): menu activation logic by syncing active

This commit is contained in:
riefive
2025-11-15 08:21:06 +07:00
parent 979d73cca3
commit de81af9844
4 changed files with 36 additions and 14 deletions
+8 -8
View File
@@ -37,10 +37,10 @@ const tabs = ref([] as any)
const currentDisplay = ref(props.display ?? 'tab')
// activeTab selalu sinkron dengan query param
const activeTab = computed({
get: () => (route.query?.tab && typeof route.query.tab === 'string' ? route.query.tab : 'status'),
set: (val: string) => {
router.replace({ path: route.path, query: { tab: val } })
const activeMenu = computed({
get: () => (route.query?.menu && typeof route.query.menu === 'string' ? route.query.menu : 'status'),
set: (value: string) => {
router.replace({ path: route.path, query: { menu: value } })
},
})
@@ -413,14 +413,14 @@ onMounted(async () => {
<CompTab
v-if="currentDisplay === 'tab'"
:data="tabs"
:initial-active-tab="activeTab"
@change-tab="activeTab = $event"
:initial-active-tab="activeMenu"
@change-tab="activeMenu = $event"
/>
<CompMenu
v-else-if="currentDisplay === 'menu'"
:data="tabs"
:initial-active-tab="activeTab"
@change-tab="activeTab = $event"
:initial-active-menu="activeMenu"
@change-menu="activeMenu = $event"
/>
</div>
</template>