diff --git a/console/src/modules/system/plugins/PluginDetail.vue b/console/src/modules/system/plugins/PluginDetail.vue index 32cc66f59..148f5659b 100644 --- a/console/src/modules/system/plugins/PluginDetail.vue +++ b/console/src/modules/system/plugins/PluginDetail.vue @@ -37,11 +37,9 @@ const initialTabs = ref([ const route = useRoute(); const tabs = ref(cloneDeep(initialTabs.value)); -const activeTab = useRouteQuery("tab", tabs.value[0].id, { - mode: "push", -}); +const activeTab = useRouteQuery("tab", tabs.value[0].id); -provide>("activeTab", activeTab); +provide>("activeTab", activeTab); const { data: plugin } = useQuery({ queryKey: ["plugin", route.params.name], diff --git a/console/src/modules/system/plugins/tabs/Setting.vue b/console/src/modules/system/plugins/tabs/Setting.vue index 2e20deb7d..ad8228a92 100644 --- a/console/src/modules/system/plugins/tabs/Setting.vue +++ b/console/src/modules/system/plugins/tabs/Setting.vue @@ -11,7 +11,6 @@ import { Toast, VButton } from "@halo-dev/components"; // types import type { ConfigMap, Plugin, Setting } from "@halo-dev/api-client"; -import { useRouteQuery } from "@vueuse/router"; import { useI18n } from "vue-i18n"; import { useQuery, useQueryClient } from "@tanstack/vue-query"; import { toRaw } from "vue"; @@ -19,8 +18,7 @@ import { toRaw } from "vue"; const { t } = useI18n(); const queryClient = useQueryClient(); -const group = useRouteQuery("tab", undefined, { mode: "push" }); - +const group = inject>("activeTab", ref("basic")); const plugin = inject>("plugin"); const setting = inject>("setting", ref()); const saving = ref(false); diff --git a/console/src/modules/system/settings/SystemSettings.vue b/console/src/modules/system/settings/SystemSettings.vue index bf6bfd414..91e3486a0 100644 --- a/console/src/modules/system/settings/SystemSettings.vue +++ b/console/src/modules/system/settings/SystemSettings.vue @@ -18,11 +18,8 @@ import type { Component } from "vue"; import { markRaw } from "vue"; import SettingTab from "./tabs/Setting.vue"; import { useRouteQuery } from "@vueuse/router"; -import { watch } from "vue"; -import { useRouter } from "vue-router"; const { t } = useI18n(); -const router = useRouter(); interface Tab { id: string; @@ -38,7 +35,8 @@ const tabs = ref([ }, ]); -const activeTab = useRouteQuery("tab", undefined, { mode: "push" }); +const activeTab = useRouteQuery("tab", "basic"); +provide>("activeTab", activeTab); const { data: setting } = useQuery({ queryKey: ["system-setting"], @@ -66,18 +64,6 @@ const { data: setting } = useQuery({ }, }); -watch( - () => activeTab.value, - (value) => { - if (!value) { - router.replace({ - name: "SystemSetting", - query: { tab: tabs.value[0].id }, - }); - } - } -); - provide>("setting", setting);