The project uses a module-based routing system where routes are automatically discovered and loaded from the ./src/router/modules/ directory. Routes are categorized into two types based on their file naming convention:
- Homepage Routes: Any file named
homepage.ts within a module folder (e.g., ./modules/user/homepage.ts) is treated as a homepage-related route and exported via homepageRouterList. - Fixed Routes: All other
.ts files in the modules directory (excluding those named homepage.ts) are treated as standard fixed routes and exported via fixedRouterList.
To add new routes, create a .ts file in a subdirectory of src/router/modules/ and export a RouteRecordRaw object or an array of RouteRecordRaw objects as the default export.
// Example of a new module route: src/router/modules/settings/index.ts
import type { RouteRecordRaw } from 'vue-router';
const route: RouteRecordRaw = {
path: '/settings',
name: 'settings',
component: () => import('@/pages/settings/index.vue'),
};
export default route;