|
|
@@ -1,22 +1,43 @@
|
|
|
import { NgModule } from '@angular/core';
|
|
|
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
|
|
|
|
|
|
+// 定义应用的路由配置
|
|
|
const routes: Routes = [
|
|
|
{
|
|
|
- path: 'home',
|
|
|
- loadChildren: () => import('./home/home.module').then( m => m.HomePageModule)
|
|
|
+ path: 'home', // 路由路径为 '/home'
|
|
|
+ loadChildren: () => import('./home/home.module').then(m => m.HomePageModule) // 懒加载 HomeModule
|
|
|
},
|
|
|
{
|
|
|
- path: '',
|
|
|
- redirectTo: 'home',
|
|
|
- pathMatch: 'full'
|
|
|
+ path: '', // 默认路径
|
|
|
+ redirectTo: 'home', // 重定向到 'home'
|
|
|
+ pathMatch: 'full' // 完全匹配
|
|
|
},
|
|
|
+ {
|
|
|
+ path: 'schedule', // 路由路径为 '/schedule'
|
|
|
+ loadChildren: () => import('./schedule/schedule.module').then(m => m.SchedulePageModule) // 懒加载 ScheduleModule
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: 'task', // 路由路径为 '/task'
|
|
|
+ loadChildren: () => import('./task/task.module').then(m => m.TaskPageModule) // 懒加载 TaskModule
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: 'reminders', // 路由路径为 '/reminders'
|
|
|
+ loadChildren: () => import('./reminders/reminders.module').then(m => m.RemindersPageModule) // 懒加载 RemindersModule
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: 'settings', // 路由路径为 '/settings'
|
|
|
+ loadChildren: () => import('./settings/settings.module').then(m => m.SettingsPageModule) // 懒加载 SettingsModule
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '**', // 处理未匹配的路径
|
|
|
+ redirectTo: 'home' // 重定向到 'home'
|
|
|
+ }
|
|
|
];
|
|
|
|
|
|
@NgModule({
|
|
|
imports: [
|
|
|
- RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
|
|
|
+ RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) // 配置路由
|
|
|
],
|
|
|
- exports: [RouterModule]
|
|
|
+ exports: [RouterModule] // 导出 RouterModule
|
|
|
})
|
|
|
-export class AppRoutingModule { }
|
|
|
+export class AppRoutingModule { }
|