【问题标题】:Ion-tabs are not refreshed when navigates from another page从另一个页面导航时不刷新离子标签
【发布时间】:2017-03-07 13:18:13
【问题描述】:

当我使用 navController.setRoot() 从另一个窗格重定向到 TabsPage 时,选项卡视图不会刷新。 tabs.ts 中的值会更新,但不会反映在视图中。

请推荐!

这是我的代码

<ion-tabs>
   <ion-tab [root]="tab1Root" tabIcon="md-paper"></ion-tab>
 <!--<ion-tab [root]="tab1Root" tabIcon="md-paper" (ionSelect)="goToHome()"></ion-tab>-->
 <ion-tab [root]="tab2Root" tabIcon="md-apps"></ion-tab>
 <ion-tab *ngIf="selectedItem == 'true'"  (ionSelect)="newBlog()" tabIcon="md-add-circle"></ion-tab>   
</ion-tabs>

selectedItem 的值已更改,但视图未根据此更改的值更新

【问题讨论】:

    标签: angular typescript ionic-framework ionic2


    【解决方案1】:

    试试:
    *ngIf="selectedItem"

    或:
    *ngIf="selectedItem == true"。没有引号。 用引号给出意味着它是一个字符串文字。

    【讨论】:

    • 其实我用过this.navCtrl.setRoot(TabsPage);此方法从登录页面重定向到 TabsPage 。 tabs.ts 中的值已更新,但 tabs.html 未更新。这是正确的吗? [show]="selectedItem" 也不起作用
    • ionicframework.com/docs/v2/api/components/tabs/Tab 根据这个显示是一个输入属性
    猜你喜欢
    • 1970-01-01
    • 2017-05-13
    • 2023-01-19
    • 2020-03-11
    • 2021-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多