6868 <div v-if =" !coreStore?.config?.settingPages || coreStore?.config?.settingPages.length === 0" >
6969 <p >No setting pages configured or still loading...</p >
7070 </div >
71- <VerticalTabs v-else ref =" VerticalTabsRef" @update:active-tab =" setURL({slug: $event, pageLabel: ''})" >
71+ <VerticalTabs v-else ref =" VerticalTabsRef" v-model:active-tab = " activeTab " @update:active-tab =" setURL({slug: $event, pageLabel: ''})" >
7272 <template v-for =" (c ,i ) in coreStore ?.config ?.settingPages " :key =" ` tab:${settingPageSlotName (c ,i )} ` " v-slot :[' tab:' + settingPageSlotName (c ,i ) ]>
7373 <div class =" flex items-center justify-center whitespace-nowrap w-full px-4 gap-2" @click =" setURL(c)" >
7474 <component v-if =" c.icon" :is =" getIcon(c.icon)" class =" w-5 h-5 group-hover:text-lightSidebarIconsHover transition duration-75 dark:group-hover:text-darkSidebarIconsHover dark:text-darkSidebarIcons" ></component >
@@ -98,6 +98,7 @@ import { IconMoonSolid, IconSunSolid } from '@iconify-prerendered/vue-flowbite';
9898import adminforth from ' @/adminforth' ;
9999import { VerticalTabs } from ' @/afcl'
100100import { useRoute } from ' vue-router'
101+ import UserMenuSettingsButton from ' ../components/UserMenuSettingsButton.vue' ;
101102
102103const route = useRoute ()
103104const coreStore = useCoreStore ();
@@ -111,6 +112,11 @@ const sideBarOpen = ref(false);
111112const theme = ref (' light' );
112113const dropdownUserButton = ref <HTMLElement | null >(null );
113114const VerticalTabsRef = ref ();
115+ const activeTab = ref (' ' );
116+
117+ watch (() => route ?.params ?.page , (val ) => {
118+ handleURLChange (val as string | null );
119+ });
114120
115121async function initRouter() {
116122 await router .isReady ();
@@ -157,20 +163,7 @@ onMounted(async () => {
157163 setURL (coreStore .config .settingPages [0 ]);
158164 }
159165 } else {
160- let isParamInTabs;
161- for (const c of coreStore ?.config ?.settingPages || []) {
162- if (c .slug ? c .slug === routeParamsPage : slugifyString (c .pageLabel ) === routeParamsPage ) {
163- isParamInTabs = true ;
164- break ;
165- }
166- }
167- if (isParamInTabs ) {
168- VerticalTabsRef .value .setActiveTab (routeParamsPage );
169- } else {
170- if (coreStore .config ?.settingPages ?.[0 ]) {
171- setURL (coreStore .config .settingPages [0 ]);
172- }
173- }
166+ handleURLChange (routeParamsPage as string | null );
174167 }
175168});
176169
@@ -205,4 +198,22 @@ function setURL(item: {
205198 });
206199 }
207200}
201+
202+ function handleURLChange(val : string | null ) {
203+ let isParamInTabs;
204+ for (const c of coreStore ?.config ?.settingPages || []) {
205+ if (c .slug ? c .slug === val : slugifyString (c .pageLabel ) === val ) {
206+ isParamInTabs = true ;
207+ break ;
208+ }
209+ }
210+ if (isParamInTabs ) {
211+ VerticalTabsRef .value .setActiveTab (val );
212+ activeTab .value = val as string ;
213+ } else {
214+ if (coreStore .config ?.settingPages ?.[0 ]) {
215+ setURL (coreStore .config .settingPages [0 ]);
216+ }
217+ }
218+ }
208219 </script >
0 commit comments