mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
refactor(projects): 优化路由声明,添加路由模块导入,规范路相关文件夹
This commit is contained in:
@ -5,7 +5,8 @@ import Login from '@/views/system/login/index.vue';
|
||||
import NoPermission from '@/views/system/exception/403.vue';
|
||||
import NotFound from '@/views/system/exception/404.vue';
|
||||
import ServiceError from '@/views/system/exception/500.vue';
|
||||
import { routeName, routePath, routeTitle } from '../const';
|
||||
import { routeName, routePath, routeTitle } from '../constant';
|
||||
import { ROUTE_HOME_NAME } from './route-home';
|
||||
|
||||
/**
|
||||
* 固定不变的路由
|
||||
@ -13,8 +14,14 @@ import { routeName, routePath, routeTitle } from '../const';
|
||||
*/
|
||||
const constantRoutes: RouteRecordRaw[] = [
|
||||
{
|
||||
name: 'single_',
|
||||
path: '/single_',
|
||||
name: routeName('root'),
|
||||
path: routePath('root'),
|
||||
redirect: { name: ROUTE_HOME_NAME }
|
||||
},
|
||||
{
|
||||
// 名称、路由随意,不在路由声明里面,只是为各个页面充当传递BlankLayout的桥梁,因此访问该路由时重定向到404
|
||||
name: 'constant-single_',
|
||||
path: '/constant-single_',
|
||||
component: BlankLayout,
|
||||
redirect: { name: routeName('not-found') },
|
||||
meta: {
|
@ -1,9 +1,8 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
import ROUTE_HOME from './routeHome';
|
||||
import customRoutes from '../modules';
|
||||
import constantRoutes from './constant';
|
||||
import constantRoutes from './constant-routes';
|
||||
|
||||
/** 所有路由 */
|
||||
export const routes: RouteRecordRaw[] = [...customRoutes, ...constantRoutes];
|
||||
|
||||
export { ROUTE_HOME, customRoutes };
|
||||
export { ROUTE_HOME } from './route-home';
|
||||
|
9
src/router/routes/route-home.ts
Normal file
9
src/router/routes/route-home.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { getRouteHome } from '@/utils';
|
||||
import { routeName } from '../constant';
|
||||
import customRoutes from '../modules';
|
||||
|
||||
/** 路由首页的名字 */
|
||||
export const ROUTE_HOME_NAME = routeName('dashboard_analysis');
|
||||
|
||||
/** 路由首页 */
|
||||
export const ROUTE_HOME = getRouteHome(customRoutes, ROUTE_HOME_NAME);
|
@ -1,21 +0,0 @@
|
||||
import type { CustomRoute } from '@/interface';
|
||||
import { setRouterCacheName } from '@/utils';
|
||||
import DashboardAnalysis from '@/views/dashboard/analysis/index.vue';
|
||||
import { getRouteConst } from '../const';
|
||||
|
||||
const { name, path, title } = getRouteConst('dashboard_analysis');
|
||||
|
||||
setRouterCacheName(DashboardAnalysis, name);
|
||||
|
||||
/** 路由首页 */
|
||||
const ROUTE_HOME: CustomRoute = {
|
||||
name,
|
||||
path,
|
||||
component: DashboardAnalysis,
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
title
|
||||
}
|
||||
};
|
||||
|
||||
export default ROUTE_HOME;
|
Reference in New Issue
Block a user