【问题标题】:I can't seem to figure out these error with SplashScreen and StatusBar Ionic 6.12.4我似乎无法用 SplashScreen 和 StatusBar Ionic 6.12.4 找出这些错误
【发布时间】:2021-05-13 08:22:41
【问题描述】:

enter image description here

由于某种原因,我正在使用 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();
    });
  }
}

【问题讨论】:

  • 检查您的app.module.ts,您可能已经在没有 ngx 的情况下导入了它们。

标签: angular ionic-framework cordova-plugins


【解决方案1】:

你必须直接使用SplashScreen.hide();。

这是错误消息试图告诉您的内容。 SplashScreen 已经是您尝试在构造函数中实例化的值。

该值是SplashScreenPlugin 的一个实例。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-18
    • 1970-01-01
    • 2021-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多