From 68848b3a12e67ce0ed4dcfe1b6bcd88156bf01aa Mon Sep 17 00:00:00 2001 From: valarchie <343928303@qq.com> Date: Tue, 20 Feb 2024 17:02:57 +0800 Subject: [PATCH] Revert "Fix: Ensure route.children existence before accessing in initRouter() and Fix serverConfig.json fetching behavior across nested routes" --- src/config/index.ts | 2 +- src/router/index.ts | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/config/index.ts b/src/config/index.ts index 1395088..4cd3016 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -31,7 +31,7 @@ export const getServerConfig = async (app: App): Promise => { app.config.globalProperties.$config = getConfig(); return axios({ method: "get", - url: `${window.location.origin}/serverConfig.json` + url: `${VITE_PUBLIC_PATH}serverConfig.json` }) .then(({ data: config }) => { let $config = app.config.globalProperties.$config; diff --git a/src/router/index.ts b/src/router/index.ts index 9df7082..8565cd2 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -158,12 +158,7 @@ router.beforeEach((to: ToRouteType, _from, next) => { getTopMenu(true); // query、params模式路由传参数的标签页不在此处处理 if (route && route.meta?.title) { - if ( - isAllEmpty(route.parentId) && - route.meta?.backstage && - route.children && - route.children.length > 0 - ) { + if (isAllEmpty(route.parentId) && route.meta?.backstage) { // 此处为动态顶级路由(目录) const { path, name, meta } = route.children[0]; useMultiTagsStoreHook().handleTags("push", {