From f78037103d3e48c4349b34e6f7e2b294ae901c08 Mon Sep 17 00:00:00 2001 From: ahao Date: Sun, 24 Sep 2023 22:48:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/permission.ts | 2 +- src/types/router.d.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/permission.ts b/src/permission.ts index 4543d08..2c2c5ac 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -15,7 +15,7 @@ const whiteList = ['/login', '/register', '/social-callback']; router.beforeEach(async (to, from, next) => { NProgress.start(); if (getToken()) { - to.meta.title && useSettingsStore().setTitle(to.meta.title as string); + to.meta.title && useSettingsStore().setTitle(to.meta.title); /* has token*/ if (to.path === '/login') { next({ path: '/' }); diff --git a/src/types/router.d.ts b/src/types/router.d.ts index 9731fa2..3e113e6 100644 --- a/src/types/router.d.ts +++ b/src/types/router.d.ts @@ -1,6 +1,10 @@ import { RouteRecordRaw } from 'vue-router'; declare module 'vue-router' { + interface RouteMeta { + title: string; + } + declare type RouteOption = { hidden?: boolean; permissions?: string[];