From 24b0f6e1cfc3481258cfc3f5bd8144cd8c4cee0b Mon Sep 17 00:00:00 2001 From: Gzx1999 Date: Tue, 21 Nov 2023 18:43:44 +0800 Subject: [PATCH] update document title before route --- frontend/src/router/index.ts | 10 ++++++++++ frontend/src/views/Login/Login.vue | 6 ++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 0330c4b..008391a 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -197,3 +197,13 @@ export function updateSidebarItems() { routerStore().menus = menus; } + +router.beforeEach((to, from)=>{ + if (to.meta && to.meta.header_title) { + document.title = to.meta.header_title + } +}) + +export function directTo(to:any) { + router.push(to) +} \ No newline at end of file diff --git a/frontend/src/views/Login/Login.vue b/frontend/src/views/Login/Login.vue index 0590eab..cddaad7 100644 --- a/frontend/src/views/Login/Login.vue +++ b/frontend/src/views/Login/Login.vue @@ -31,8 +31,8 @@