Ionic2,如何将自定义插件(appsee 或 uxcam)导入到 Ionic App 中

2024-03-31

我正在尝试使用Appsee https://www.appsee.com/docs/ios/ionic or UXcam https://uxcam.com/docs

我尝试像下面这样导入,但没有成功 // 从 '@ionic-native/appsee' 导入 { Appsee };

在其他地方,我看到你必须声明有问题的变量,以便打字稿识别该变量,我这样做如下

声明 var cordova:any;

// import { Appsee } from '@ionic-native/appsee';

declare var cordova:any;

@Component({
  templateUrl: 'app.html'
})
export class MyApp {

  rootPage:any = LoginPage;       // FOR TESTING

  constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
    platform.ready().then(() => {
    cordova.plugins.Appsee.start("my key");

      // 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();
    });
  }
}

我还尝试将 public appsee: Appsee 添加到构造函数中,但仍然没有成功。

任何指导表示赞赏。我越来越ReferenceError:cordova 未定义。

如何导入自定义插件,appsee https://www.appsee.com/docs/ios/ionic

编辑添加建议代码 声明 var Appsee:any;

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  rootPage:any = LoginPage;       // FOR TESTING

  constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
    platform.ready().then(() => {
    Appsee.start("my key");

      // 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();
    });
  }
}

你只需要把它放在下面imports如下所示。

//your other imports here

declare var Appsee:any;

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  @ViewChild(Nav) nav: Nav;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Ionic2,如何将自定义插件(appsee 或 uxcam)导入到 Ionic App 中 的相关文章

随机推荐