优化代码

This commit is contained in:
ahao 2023-09-24 22:48:07 +08:00
parent eebd0c3891
commit f78037103d
2 changed files with 5 additions and 1 deletions

View File

@ -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: '/' });

View File

@ -1,6 +1,10 @@
import { RouteRecordRaw } from 'vue-router';
declare module 'vue-router' {
interface RouteMeta {
title: string;
}
declare type RouteOption = {
hidden?: boolean;
permissions?: string[];