perf: 使用/** */替换//注释,对编辑器的智能提示更友好

This commit is contained in:
xiaoxian521
2022-09-11 16:46:21 +08:00
parent 230af57c3e
commit ee65ec9f72
12 changed files with 45 additions and 46 deletions

View File

@@ -32,25 +32,25 @@ import homeRouter from "./modules/home";
import errorRouter from "./modules/error";
import remainingRouter from "./modules/remaining";
// 原始静态路由(未做任何处理)
/** 原始静态路由(未做任何处理) */
const routes = [homeRouter, errorRouter];
// 导出处理后的静态路由(三级及以上的路由全部拍成二级)
/** 导出处理后的静态路由(三级及以上的路由全部拍成二级) */
export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
formatFlatteningRoutes(buildHierarchyTree(ascending(routes)))
);
// 用于渲染菜单,保持原始层级
/** 用于渲染菜单,保持原始层级 */
export const constantMenus: Array<RouteComponent> = ascending(routes).concat(
...remainingRouter
);
// 不参与菜单的路由
/** 不参与菜单的路由 */
export const remainingPaths = Object.keys(remainingRouter).map(v => {
return remainingRouter[v].path;
});
// 创建路由实例
/** 创建路由实例 */
export const router: Router = createRouter({
history: getHistoryMode(),
routes: constantRoutes.concat(...(remainingRouter as any)),
@@ -70,7 +70,7 @@ export const router: Router = createRouter({
}
});
// 重置路由
/** 重置路由 */
export function resetRouter() {
router.getRoutes().forEach(route => {
const { name, meta } = route;
@@ -84,7 +84,7 @@ export function resetRouter() {
usePermissionStoreHook().clearAllCachePage();
}
// 路由白名单
/** 路由白名单 */
const whiteList = ["/login"];
router.beforeEach((to: toRouteType, _from, next) => {