我有一个ResultPage与模板resultpage.html有超过1000个html行代码.在HomePage中,我想通过navCtrl.setRoot导航到ResultPage.当我调用它时,屏幕在3-4s内冻结,然后将我带到ResultPage.这真的是一个糟糕的用户体验.它只发生在lagre teamplate并且在我第一次进入该页面时.我决定删除ResultPage中的延迟加载和滞后消失.我不知道这是正确的方法吗?有人可以告诉我在这种情况下该怎么做?
非常感谢!
解决方法
By default,preloading is turned off so setting this property would do
nothing. preloading eagerly loads all deep links after the application
boots instead of on demand as needed. To enable preloading,set
preloadModules in the main application module config to true:
@NgModule({ declarations: [ MyApp ],imports: [ browserModule,IonicModule.forRoot(MyApp,{ preloadModules: true // <- Here! }) ],bootstrap: [IonicApp],entryComponents: [ MyApp ] }) export class AppModule { }
If preloading is turned on,it will load the modules based on the
value of priority. The following values are possible for priority:
“high”,“low”,and “off”. When there is no priority,it will be set to
“low”.All deep links with their priority set to “high” will be loaded first.
Upon completion of loading the “high” priority modules,all deep links
with a priority of “low” (or no priority) will be loadedSetting the priority is as simple as passing it to the @IonicPage
decorator:
@IonicPage({ name: 'my-page',priority: 'high' })
所以在你的情况下,我会尝试将优先级设置为高到:
>加载应用程序时用户将与之交互的第一个页面(例如HomePage)
> ResultPage以保持已预加载并在用户重定向到它时更快地显示它.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。