export class HomePage {
splash= true;
constructor() {}
ionViewDidLoad() {
setTimeout(() =>
{
this.splash = false;
}, 4000);
}
}
ion-content {
--background: #FFBF00;
}
.tree {
left: 0;
right: 5%;
margin: 0 auto;
top: 50%;
transform: translateY(-50%);
width: 100%;
position: absolute;
}
.tree>div {
position: absolute;
height: 100%;
width: 100%;
background: #FFBF00;
top: 0;
left: 0;
-webkit-animation-name: hello;
-webkit-animation-duration: 5s;
-webkit-animation-fill-mode: forwards;
animation-name: hello;
animation-duration: 5s;
animation-fill-mode: forwards;
}
@keyframes hello {
0% {
height: 100%;
}
100% {
height: 0%;
}
}
@-webkit-keyframes hello {
0% {
height: 100%;
}
100% {
height: 0%;
}
}
<ion-content>
<div class="tree" text-center [style.display]="splash ? 'block': 'none'">
<div></div>
<img src="assets/logo.svg">
</div>
</ion-content>
config.xml
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashScreenDelay" value="0" />
<preference name="ShowSplashScreen" value="false" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
答案 0 :(得分:1)
在您的config.xml
文件的下面添加
<preference name="FadeSplashScreen" value="false"/>
<preference name="AutoHideSplashScreen" value="false"/>
,并使用modalController
进行飞溅屏幕显示,
ionViewDidEnter() {
this.splashScreen.hide();
setTimeout(() => {
this.modalCtrl.dismiss();
}, 4000);
}