[英]Ionic3 Tabs doesn't work with lazy loading
after read official documentation here and after spent a lot of times, my code doesn't load tabs with ionic tabs and lazy loading. 阅读后,官方文档这里之后花费了大量的时间,我的代码不会加载与离子标签和懒装载片。
Here is it my .ts file 这是我的.ts文件
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-name',
templateUrl: 'name.html',
})
export class NamePage {
tab1: "Tab1Page";
tab2: "Tab2Page";
tab3: "Tab3Page";
constructor(public navCtrl: NavController, public navParams: NavParams) { }
ionViewDidLoad() { }
}
And here is it my .html file 这是我的.html文件
<ion-content>
<ion-tabs>
<ion-tab [root]="tab1" tabIcon="reorder"></ion-tab>
<ion-tab [root]="tab2" tabIcon="pin"></ion-tab>
<ion-tab [root]="tab3" tabIcon="search"></ion-tab>
</ion-tabs>
</ion-content>
Here is it also my app.component.ts: 这是我的app.component.ts:
rootPage:any = 'NamePage';
After compile code, the page is white page with hidden components. 编译代码后,页面是带有隐藏组件的白页。 For view tabs i put this code:
对于视图选项卡,我输入以下代码:
.tabbar {
opacity: 1;
}
but the buttons still no work; 但按钮仍无法正常工作; after click on a single button nothing is changing (the white screen remain).
点击一个按钮后没有任何变化(白色屏幕仍然存在)。
I put also console log 我还把控制台日志
ionViewDidLoad() {
console.log('ionViewDidLoad NamePage');
}
The only thing present in the console is this one. 控制台中唯一存在的就是这个。
can someone give me a suggestion? 有人可以给我一个建议吗?
Try this: 尝试这个:
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { HomePage } from ....
@IonicPage()
@Component({
selector: 'page-name',
templateUrl: 'name.html',
})
export class NamePage {
tab1: any;
tab2: any;
tab3: any;
constructor(public navCtrl: NavController, public navParams: NavParams) {
this.tab1 = HomePage
......(other pages)
}
ionViewDidLoad() { }
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.