编写路由代码。

This commit is contained in:
2025-10-23 17:52:01 +08:00
parent fd4275c3a5
commit 7ea8e7ab4d
24 changed files with 1606 additions and 150 deletions

View File

@@ -2,17 +2,56 @@
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-10-13 15:31:41
* @LastEditors: Kane Wang
* @LastModified: 2025-10-13 15:37:20
* @LastModified: 2025-10-23 17:47:28
* @FilePath: src/router/index.ts
* @Description:
*
* Copyright (c) 2025 by Kane All rights reserved
*/
import { createRouter, createWebHashHistory } from "vue-router";
import { type RouteRecordNormalized } from "vue-router";
// import index from "../layout/console/index.vue";
export declare interface SideBarRouteRecordNormalized extends RouteRecordNormalized
{
hidden?: boolean;
}
const routes = [
{
path: "/console",
name: "Console",
hidden: true,
// component: index,
component: () => import( "../layout/console/Index.vue" ),
},
];
const router = createRouter({
history: createWebHashHistory(),
routes:[],
routes: routes,
});
export default router;
// 工具函数
/* eslint-disable */
function hasOnlyChild( children: any ): boolean
{
if ( !children )
{
return false;
}
const routes = children.filter(( item: any )=>
{
return !item.hidden;
});
if ( routes.length === 1 )
{
return true;
}
return false;
}
export { router, hasOnlyChild };