Ionic4—子路由tabs-routing.module详解

本文详细解析了Ionic4中的tabs-routing.module,包括子路由的配置、依赖详解、@NgModule装饰器的使用。重点介绍了如何设置组件的父子路由、组件懒加载、页面重定向以及路由匹配策略。
摘要由CSDN通过智能技术生成

目录

一、概述

二、依赖详解

三、配置子路由

四、@NgModule装饰器


一、概述

tabs-routing.module是Ionic4的一个子路由配置文件。

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { TabsPage } from './tabs.page';

const routes: Routes = [
    {
        path: 'tabs',
        component: TabsPage,
        children: [
            {
                path: 'tab1',
                children: [
                    {
                       path: '', 
                       loadChildren:()=>import('../tab1/tab1.module').then(m=>m.Tab1PageModule)
                    }
                ]
            },
            {
                path: '',
                redirectTo: '/tabs/tab1',
                pathMatch: 'full'
            }
        ]
    },
    {
        path: '',
        redirectTo: '/tabs/tab1',
        pathMatch: 'full'
    }
];

@NgModule({
    imports: [RouterModule.forChild(routes)],
    exports: [RouterModule]
})
export class TabsPageRoutingModule {}

二、依赖详解

//Angular核心
import { NgModule } from '@angular/core';
//路由
import { RouterModule, Routes } from '@a
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值