【问题标题】:Ionic 3 lazy loaded modal/page takes too much time to appear for the first time [duplicate]Ionic 3延迟加载模式/页面第一次出现需要太多时间[重复]
【发布时间】:2017-12-14 17:04:47
【问题描述】:

我有一个在 Ionic 3 应用程序中用作模态的页面。而且我的问题是,第一次调用它时,我可以看到按钮动画是如何结束的,但 Modals 仍然没有出现。

我第二次调用它,它来得真快。

这是我的 html (i

<ion-navbar color="primary">
    <button ion-button
            menuToggle>
        <ion-icon name="menu"></ion-icon>
    </button>
    <ion-title text-capitalize>{{ 'FEEDBACK' | translate }}</ion-title>
    <ion-buttons end>
        <button class="config-button"
                ion-button
                tappable
                (touchend)="openConfig()">
            <ion-icon name="md-more"></ion-icon>
        </button>
    </ion-buttons>

</ion-navbar>

和功能

openConfig() {
    let profileModal = this.modalCtrl.create('ConfigModalPage' , { userId: 8675309 });
    profileModal.present();
}

如果我删除延迟加载行为,它会加载得更快,但第一次仍然感觉迟钝。

我怎样才能加快这个模式?

【问题讨论】:

    标签: angular ionic-framework ionic2 ionic3


    【解决方案1】:

    在您的函数中,您没有使用延迟加载方法,因为您的模态控制器采用 Component 而不是字符串。

    ConfigModalPage 应该是字符串 - 'ConfigModalPage'。

    为此,您的组件必须具有正确的模块配置。如果您可以共享这些文件,我可以提供帮助。

    旁注 - 为什么要为按钮使用 touchend 事件?

    【讨论】:

    • 我将它从字符串更改为组件名称,因为我正在测试它在没有延迟加载的情况下有多慢。并且 touchend 也用于测试是否有帮助。
    • 那么你应该给出你所问问题的完整背景。
    • 好吧,我写了“如果我删除延迟加载行为,它会加载得更快,但第一次仍然感觉迟钝。”
    猜你喜欢
    • 2018-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-11
    • 1970-01-01
    • 2015-09-16
    • 1970-01-01
    • 2017-11-20
    相关资源
    最近更新 更多