欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ionic3 懶加載

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

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

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

默認(rèn)狀態(tài)下每個(gè)頁面都會(huì)對應(yīng)一個(gè)模塊,如果項(xiàng)目之中的頁面比較多那么最后構(gòu)建的項(xiàng)目中的將會(huì)看到有很多的 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. 一個(gè)模塊對應(yīng)多個(gè)頁面

修改后的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),
   //將兩個(gè)子頁面模塊引入
   UserPasswordPageModule,
   UsernamePageModule,
  ],
  entryComponents: [
   SettingPage,
  ]
 })
 export class SettingPageModule {}

總結(jié)

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

相關(guān)文章

最新評論