我希望标题完全自我解释。 Nativescript现在支持AOT和延迟加载,但我很努力在https://github.com/nativescript/nativescript-sdk-examples-ng的示例之上实现预加载。如果运行提供的示例,您会注意到切换页面(加载不同模块)之间的延迟1s。如何在Nativescript中预加载惰性加载的模块
Nativescript 2.5有可能吗?
我希望标题完全自我解释。 Nativescript现在支持AOT和延迟加载,但我很努力在https://github.com/nativescript/nativescript-sdk-examples-ng的示例之上实现预加载。如果运行提供的示例,您会注意到切换页面(加载不同模块)之间的延迟1s。如何在Nativescript中预加载惰性加载的模块
Nativescript 2.5有可能吗?
是的,这是可能的,至少在NS 3.0。我问这nativescript论坛: https://discourse.nativescript.org/t/is-it-possible-to-preload-lazy-loaded-modules/1363
这很容易,你只需要直接使用角度路由器功能: NativeScriptRouterModule.forRoot(ROUTES, {preloadingStrategy: PreloadAllModules} // import { PreloadAllModules } from "@angular/router"; )
下面是你可以得到一个例子https://github.com/sis0k0/lazyNinjas – Dlucidone
是的,谢谢你,这个例子显示延迟加载,但不是预加载惰性加载的路由:)我想避免1秒的延迟,而路由是根据请求加载的(即在用户点击新路由之前预加载它)。 – nbo