ionic2下创建项目后,运行启动页后白屏几秒,解决方案

问题描述

最近在学习过程中发现ionic2项目运行在真机上,启动页后会有3-5秒的白屏时间,用户体验不是太好。

解决过程

一、安装Cordova splash screen插件

[html]  view plain  copy
  1. $ cd myapp  
  2. $ ionic plugin add org.apache.cordova.splashscreen  

二、配置config.xml文件



    Sidemenu
    test app.
    Ionic Framework Team
    
    
    
    
    
    
    
    
    
    
        
         
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        

    
    
        
        
    
    
    
    
    
    
    
    
    

    
    
    
    
    
    
    
    
    

    
        
    
    
    
    
    
    
    
    


三、配置app.component.ts
 initializeApp() {
    this.platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.styleDefault();
      Splashscreen.hide();//添加代码
    });
  }


你可能感兴趣的:(ionic)