From 68e28f7f3001d4f3cddc46a1156bbea1ced1e68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Mon, 23 Dec 2024 10:56:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E8=A1=8C=E4=B8=BA=E5=92=8C=E4=BC=98=E5=8C=96=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=B3=A8=E5=86=8C=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/router/index.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/router/index.ts b/src/plugins/router/index.ts index 05176bc..ad2b5e5 100644 --- a/src/plugins/router/index.ts +++ b/src/plugins/router/index.ts @@ -6,21 +6,22 @@ const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes, strict: true, + scrollBehavior: () => ({ left: 0, top: 0 }), }); +if (import.meta.hot) handleHotUpdate(router); +if ($__DEV__) Object.assign(window, { router }); router.onError((error) => { console.debug('🚨 [router error]: ', error); }); -if (import.meta.hot) handleHotUpdate(router); -if ($__DEV__) Object.assign(window, { router }); - function setupRouter(app: import('vue').App) { app - .use(DataLoaderPlugin, { router }) // Register the plugin before the router - .use(router); // adding the router will trigger the initial navigation + // Register the plugin before the router + .use(DataLoaderPlugin, { router }) + // adding the router will trigger the initial navigation + .use(router); } export { router, setupRouter }; - // ======================================================================== // =========================== Router Guards ============================== // ========================================================================