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[];