-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Nc fix: add tab key to query params #9585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -46,9 +46,19 @@ const tabs: Array<{ | |||||||||||||||
| }, | ||||||||||||||||
| ] | ||||||||||||||||
|
|
||||||||||||||||
| const updateTab = (key: string) => { | ||||||||||||||||
| $e(`c:nocodb:feed, tab:${key}`) | ||||||||||||||||
| } | ||||||||||||||||
| const router = useRouter() | ||||||||||||||||
|
|
||||||||||||||||
| watch(activeTab, (val) => { | ||||||||||||||||
| $e('c:nocodb:feed', { tab: val }) | ||||||||||||||||
| router.push({ query: { tab: val } }) | ||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preserve existing query parameters when updating the route The call to Consider merging the new -router.push({ query: { tab: val } })
+router.push({
+ query: {
+ ...router.currentRoute.value.query,
+ tab: val
+ }
+})📝 Committable suggestion
Suggested change
|
||||||||||||||||
| }) | ||||||||||||||||
|
|
||||||||||||||||
| onMounted(() => { | ||||||||||||||||
| const tab = router.currentRoute.value.query.tab as string | ||||||||||||||||
| if (tab && tabs.some((t) => t.key === tab)) { | ||||||||||||||||
| activeTab.value = tab | ||||||||||||||||
| } | ||||||||||||||||
| }) | ||||||||||||||||
| </script> | ||||||||||||||||
|
|
||||||||||||||||
| <template> | ||||||||||||||||
|
|
@@ -58,7 +68,7 @@ const updateTab = (key: string) => { | |||||||||||||||
| <NcTabs v-model:activeKey="activeTab" centered> | ||||||||||||||||
| <a-tab-pane v-for="tab in tabs" :key="tab.key" class="bg-gray-50 !h-full"> | ||||||||||||||||
| <template #tab> | ||||||||||||||||
| <div class="flex gap-2 items-center" @click="updateTab(tab.key)"> | ||||||||||||||||
| <div class="flex gap-2 items-center"> | ||||||||||||||||
| <GeneralIcon | ||||||||||||||||
| :class="{ | ||||||||||||||||
| 'text-brand-500': activeTab === tab.key, | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add missing import for
useRouterThe
useRouterfunction is used on line 49 but is not imported. This will result in aReferenceErrorat runtime.Please add the following import statement at the top of your script:
+import { useRouter } from 'vue-router'📝 Committable suggestion