我正在尝试用打字稿开发一个项目,但为此我需要用 javascript 运行一个库,该库的链接是 https://www.grabba.com/downloads/cordova/plugin。
当我尝试使用我的代码运行此库时,ionic 2 返回上述错误。我每天都在尝试解决它,并且已经通过了谷歌中的所有集成 JavaScript 和打字稿教程。有人会帮我运行这个库吗?
我的代码遵循以下代码:
guarda-codigo.ts:
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { GrabbaProxcard } from './com.grabba.cordova.plugin/www/grabba';
declare var cordova: any;
/*
Generated class for the GuardaCodigo page.
See http://ionicframework.com/docs/v2/components/#navigation for more info on
Ionic pages and navigation.
*/
@Component({
selector: 'page-guarda-codigo',
templateUrl: 'guarda-codigo.html'
})
export class GuardaCodigoPage {
constructor(public nav: NavController) {
function acessaGrabba(value: number){
let proxcard = new GrabbaProxcard();
proxcard.prototype.registerCallback();
}
}
ionViewDidLoad() {
console.log('ionViewDidLoad GuardaCodigoPage');
}
}
瓜尔达-科迪戈.html:
<ion-header>
<ion-navbar>
<ion-title>GuardaCodigo</ion-title>
</ion-navbar>
</ion-header>
<ion-content class="registration">
<ion-list>
<ion-item>
<ion-label> Codigo</ion-label>
<ion-input type="text" name = "Codigo"></ion-input>
</ion-item>
</ion-list>
<button ion-button onclick="acessaGrabba(2)">Trigger</button>
</ion-content>
有人可以帮我,我真的需要解决这个问题。我将不胜感激。感谢您的关注。
在下面关注我的包.json
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "2.4.8",
"@angular/compiler": "2.4.8",
"@angular/compiler-cli": "2.4.8",
"@angular/core": "2.4.8",
"@angular/forms": "2.4.8",
"@angular/http": "2.4.8",
"@angular/platform-browser": "2.4.8",
"@angular/platform-browser-dynamic": "2.4.8",
"@angular/platform-server": "2.4.8",
"@ionic/storage": "2.0.0",
"cordova": "^6.5.0",
"exec": "^0.2.1",
"ionic-angular": "2.2.0",
"ionic-native": "2.8.1",
"ionicons": "3.0.0",
"rxjs": "5.0.1",
"sw-toolbox": "3.4.0",
"zone.js": "0.7.2"
},
"devDependencies": {
"@ionic/app-scripts": "1.1.4",
"typescript": "2.0.9"
},
"cordovaPlugins": [
"com.grabba.cordova.plugin",
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"cordova-sqlite-storage",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [],
"description": "Rollers Monitor: An Ionic project"
}
谢谢你的帮助。