Ionic 3 long white screen after splash
是否有一种方法可以在我启动我的应用程序后立即获取它,然后我获得登录屏幕并乘坐SplashScreen。
还是一种修改方式,使我的动画成为我的SplashScreen?
谢谢。
在config.xml中放置更长的超时,并在加载主屏幕时自行将其禁用。
config.xml
1 | [cc] |
app.component.ts
1 2 3 | platform.ready().then(() => { splashScreen.hide(); }); |
Ionic默认将启动屏幕隐藏起来,因此,如果隐藏了启动屏幕,但主应用程序尚未准备就绪,或者主页仍加载了一些数据,您将找到白屏!。
建议的解决方案(控制隐藏初始屏幕):
平台就绪时或在主页控制器内部时。
config.xml
1 | [cc] |
app.component.ts或home.page.ts
1 2 3 | platform.ready().then(() => { splashScreen.hide(); }); |
我现在测试的最好的解决方案是:
config.xml:
1 2 3 4 | //Put a long time for splash screen delay to avoid that the splash screen hides and the interface become white: [cc] //just animation duration before being hided [cc] |
app.component.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 | constructor( public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen ){ // ensure that the interface is loaded by adding 500ms or less before hiding the splash screen manually this.platform.ready().then(() => { setTimeout(() => { this.splashScreen.hide(); }, 500); }); } |
您可以在生产模式下运行/构建应用程序。
对于Android Build,例如:
对于Android Run,例如:
使用离子科尔多瓦cli
构建
使用离子科尔多瓦cli
运行