如何解决我似乎无法通过 SplashScreen 和 StatusBar Ionic 6.12.4
出于某种原因,我正在使用 Ionic 6.12.4 构建应用程序,但我一直收到此错误代码。我正在放置错误的屏幕截图和我的代码示例。如果有什么我可以不用或可以添加的,请告诉我。
app.component.ts
import { Component,OnInit } from '@angular/core';
import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
@Component({
selector: 'app-root',templateUrl: 'app.component.html'
})
export class AppComponent {
public appPages = [
{
title: 'home',url: '/home',icon: 'home'
},{
title: 'List',url: '/list',icon: 'list'
}
];
constructor(
public platform: Platform,private splashScreen: SplashScreen,private statusBar: StatusBar
) {
this.initializeApp();
}
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
});
}
}
解决方法
您必须直接使用 SplashScreen.hide();
。
这就是错误消息试图告诉您的内容。 SplashScreen
已经是您尝试在构造函数中实例化的值。
该值是 SplashScreenPlugin
的一个实例。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。