我已经搜索了很多地方来寻找解决方案,但没有运气。
我需要重定向到不同的页面,当点击选项卡我的代码:
在app.html中
<ion-footer>
<ion-toolbar>
<ion-tabs>
<ion-tab tabIcon="md-home" [root]="rootPage" tabTitle="Home"></ion-tab>
<ion-tab tabIcon="md-person" [root]="profilePage" tabTitle="Profile"></ion-tab>
<ion-tab tabIcon="md-notifications" [root]="updatePage" tabTitle="Updates"></ion-tab>
</ion-tabs>
</ion-toolbar>
</ion-footer>在app.component.ts中
rootPage: any = HomePage;
profilePage: any = ProfilePage;
updatePage: any = UpdatePage;当我点击主页时,它是调用主页构造器,但没有重定向到主页。假设我在购物车页面,点击主页标签。它调用主页构造函数,但页面保持不变。
请帮帮我。我是IONIC2的ne
发布于 2017-07-09 16:44:24
您可以尝试将页面添加到app.modules.ts
entryComponents: [
MyApp,
HomePage,
rootPage,profilePage,updatePage
],并尝试将ion-tab作为根元素移动,或在ion-content内移动
<ion-content padding>
<ion-tabs tabbarPlacement="top">
<ion-tab tabIcon="md-home" [root]="rootPage" tabTitle="Home"></ion-tab>
<ion-tab tabIcon="md-person" [root]="profilePage" tabTitle="Profile"></ion-tab>
<ion-tab tabIcon="md-notifications" [root]="updatePage" tabTitle="Updates"></ion-tab>
</ion-tabs>
</ion-content>如果希望将控件放在底部,请更改为tabbarPlacement属性。
https://stackoverflow.com/questions/43985482
复制相似问题