1.首先確定每個頁面都加入了相應(yīng)的module.ts氓鄙,ts文件確定引入了@IonicPage({})
2.確定庫文件不是cnpm命令安裝的,而是npm命令
3.懶加載和deeplinks沖突升酣,確定app.module沒有配置deeplinks
4.使用懶加載,接下來使用自定義component就需要注意了
1) => ionic g component customComponent是不會自動生成module文件的噩茄,這個時候就需要我們手動去添加customComponent.module.ts文件了:
@NgModule({
? declarations: [
??? customComponent,
? ],
? imports: [
??? IonicPageModule.forChild(customComponent),
? ],
? exports: [
??? customComponent,
? ]
})
export class customComponentModule {}
2) =>components.module.ts需要引入customComponentModule文件复颈,另外需要引用自定義控件的頁面的module文件也需要引入customComponentModule。
import {MultiPickerModule} from 'ion-multi-picker';
@NgModule({
? declarations: [
? ? JoinPage,
? ],
? imports: [
? ? MultiPickerModule,
? ? IonicPageModule.forChild(JoinPage),
? ],
? exports:[
? ? JoinPage
? ]
})
暫時就這些凿菩,歡迎補(bǔ)充帜讲。