|
4 | 4 | <p>No setting pages configured or still loading...</p> |
5 | 5 | </div> |
6 | 6 | <VerticalTabs v-else ref="VerticalTabsRef" v-model:active-tab="activeTab" @update:active-tab="setURL({slug: $event, pageLabel: ''})"> |
7 | | - <template v-for="(c,i) in coreStore?.config?.settingPages" :key="`tab:${settingPageSlotName(c,i)}`" v-slot:['tab:'+settingPageSlotName(c,i)]> |
| 7 | + <template v-for="(c,i) in coreStore?.config?.settingPages" :key="`tab:${settingPageSlotName(c,i)}`" v-slot:['tab:'+c.slug]> |
8 | 8 | <div class="flex items-center justify-center whitespace-nowrap w-full px-4 gap-2" @click="setURL(c)"> |
9 | 9 | <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> |
10 | 10 | {{ c.pageLabel }} |
11 | 11 | </div> |
12 | 12 | </template> |
13 | 13 |
|
14 | | - <template v-for="(c,i) in coreStore?.config?.settingPages" :key="`${settingPageSlotName(c,i)}-content`" v-slot:[settingPageSlotName(c,i)]> |
| 14 | + <template v-for="(c,i) in coreStore?.config?.settingPages" :key="`${settingPageSlotName(c,i)}-content`" v-slot:[c.slug]> |
15 | 15 | <component |
16 | 16 | :is="getCustomComponent({file: c.component || ''})" |
17 | 17 | :resource="coreStore.resource" |
@@ -52,15 +52,6 @@ async function initRouter() { |
52 | 52 | routerIsReady.value = true; |
53 | 53 | } |
54 | 54 |
|
55 | | -function settingPageSlotName(c: { slug?: string; pageLabel?: string }, idx: number) { |
56 | | - const base = (c.slug && c.slug.trim()) || (c.pageLabel && c.pageLabel.trim()) || `tab-${idx}`; |
57 | | - return base |
58 | | - .toString() |
59 | | - .toLowerCase() |
60 | | - .replace(/\s+/g, '-') |
61 | | - .replace(/[^a-z0-9-_]/g, '-') || `tab-${idx}`; |
62 | | -} |
63 | | -
|
64 | 55 | watch(dropdownUserButton, (el) => { |
65 | 56 | if (el) { |
66 | 57 | const dd = new Dropdown( |
@@ -103,19 +94,10 @@ function setURL(item: { |
103 | 94 | pageLabel: string; |
104 | 95 | slug?: string | undefined; |
105 | 96 | }) { |
106 | | - const slug = item?.slug; |
107 | | - if (slug) { |
108 | | - router.replace({ |
109 | | - name: 'settings', |
110 | | - params: { page: slug } |
111 | | - }); |
112 | | - } else { |
113 | | - const slugified = slugifyString(item.pageLabel); |
114 | | - router.replace({ |
115 | | - name: 'settings', |
116 | | - params: { page: slugified } |
117 | | - }); |
118 | | - } |
| 97 | + router.replace({ |
| 98 | + name: 'settings', |
| 99 | + params: { page: item?.slug } |
| 100 | + }); |
119 | 101 | } |
120 | 102 |
|
121 | 103 | function handleURLChange(val: string | null) { |
|
0 commit comments