fix(components): 修复BaseLayout的HorizontalLayout

This commit is contained in:
Soybean
2021-11-19 21:39:29 +08:00
parent e70a328284
commit 0344f46c93
4 changed files with 16 additions and 14 deletions

View File

@ -1,5 +1,5 @@
import type { CustomRoute } from '@/interface';
import { BasicLayout } from '@/layouts';
import { BaseLayout } from '@/layouts';
import { setRouterCacheName } from '@/utils';
import DashboardWorkbench from '@/views/dashboard/workbench/index.vue';
import { ROUTE_HOME } from '../routes';
@ -10,7 +10,7 @@ setRouterCacheName(DashboardWorkbench, routeName('dashboard_workbench'));
const DASHBOARD: CustomRoute = {
name: routeName('dashboard'),
path: routePath('dashboard'),
component: BasicLayout,
component: BaseLayout,
redirect: { name: routeName('dashboard_analysis') },
meta: {
title: routeTitle('dashboard_analysis'),

View File

@ -22,12 +22,14 @@ export default function createRouterGuide(router: Router) {
});
}
type RouterAction = [boolean, () => void];
function handleRouterAction(to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext) {
const token = getToken();
const isLogin = Boolean(token);
const needLogin = Boolean(to.meta?.requiresAuth);
const routerAction: [boolean, () => void][] = [
const routerAction: RouterAction[] = [
// 已登录状态跳转登录页,跳转至首页
[
isLogin && to.name === routeName('login'),
@ -60,9 +62,9 @@ function handleRouterAction(to: RouteLocationNormalized, from: RouteLocationNorm
];
routerAction.some(item => {
const flag = item[0];
const [flag, callback] = item;
if (flag) {
item[1]();
callback();
}
return flag;
});