fix(encounter): menu activation logic by syncing active
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user