参考:https://www.cnblogs.com/leisir/p/8392325.html
我的做法是在config.xml中加入
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashShowOnlyFirstTime" value="false" />
然后在进入的首页的ts文件(tabs-page.ts)中加入
import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
//...
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
) { }
//...
ngOnInit() {
this.platform.ready().then(() => {
setTimeout(() => {
this.splashScreen.hide();
}, 2000)
});