亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

ionic3 懶加載

 更新時間:2017年08月16日 10:21:32   作者:♥卿  
這篇文章主要介紹了ionic3 懶加載的相關(guān)資料,需要的朋友可以參考下

ionic3 默認使用了懶加載技術(shù),相較以前預(yù)加載的版本,ionic3構(gòu)建的app在首頁加載時間上有較大的優(yōu)化,但是,ionic3默認每個頁面都會對應(yīng)一個模塊,對于頁面較多,但是每個模塊都很小的應(yīng)用可能并不怎么合理。于是,嘗試將幾個小模塊合并為幾個大的模塊。

1. 一個模塊對應(yīng)一個頁面:

默認狀態(tài)下每個頁面都會對應(yīng)一個模塊,如果項目之中的頁面比較多那么最后構(gòu)建的項目中的將會看到有很多的 js 。

原setting.module.ts

 import { NgModule } from '@angular/core';
 import { IonicPageModule } from 'ionic-angular';
 import { SettingPage } from './setting';
 @NgModule({
  declarations: [
   SettingPage,
  ],
  imports: [
   IonicPageModule.forChild(SettingPage),
  ],
  entryComponents: [
   SettingPage,
  ]
 })
 export class SettingPageModule {}

2. 一個模塊對應(yīng)多個頁面

修改后的setting.module.ts 

 import { NgModule } from '@angular/core';
 import { IonicPageModule } from 'ionic-angular';
 import { SettingPage } from './setting';
 import {UserPasswordPageModule} from "./user-password/user-password.module";
 import {UsernamePageModule} from "./username/username.module";
 @NgModule({
  declarations: [
   SettingPage,
  ],
  imports: [
   IonicPageModule.forChild(SettingPage),
   //將兩個子頁面模塊引入
   UserPasswordPageModule,
   UsernamePageModule,
  ],
  entryComponents: [
   SettingPage,
  ]
 })
 export class SettingPageModule {}

總結(jié)

以上所述是小編給大家介紹的ionic3 懶加載,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評論