From f3c391c031fe6bf8fecfe96f9758c068929fc84b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=BC=A0=E9=BE=99?= Date: Fri, 20 May 2022 18:33:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E5=86=99=E6=B3=95=E4=BB=A5=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=83=AD=E6=9B=B4=E6=96=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/router/index.js b/src/router/index.js index ed9fee5..5701bc4 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -5,7 +5,7 @@ import { basicRoutes } from './routes' const isHash = !!import.meta.env.VITE_APP_USE_HASH export const router = createRouter({ history: isHash ? createWebHashHistory('/') : createWebHistory('/'), - routes: basicRoutes, + routes: [], scrollBehavior: () => ({ left: 0, top: 0 }), }) @@ -20,6 +20,9 @@ export function resetRouter() { } export function setupRouter(app) { + basicRoutes.forEach((route) => { + !router.hasRoute(route.name) && router.addRoute(route) + }) app.use(router) setupRouterGuard(router) }