Object(...)不是WheelSelector.show的函数

时间:2019-02-18 21:35:54

标签: ionic3

下面是我的package.json文件:

"@angular/animations": "5.2.11",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "^7.2.5",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/core": "~4.15.0",
"@ionic-native/keyboard": "^4.18.0",
"@ionic-native/social-sharing": "^5.0.0",
"@ionic-native/splash-screen": "^4.15.0",
"@ionic-native/status-bar": "~4.15.0",
"@ionic-native/wheel-selector": "^5.1.0",
"@ionic/storage": "2.2.0",
"@ngx-translate/core": "^11.0.1",
"angular2-jwt": "^0.2.3",
"cordova-android": "7.1.4",
"cordova-browser": "5.0.4",
"cordova-ios": "4.5.5",
"cordova-plugin-decimal-keyboard": "1.0.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-ionic-keyboard": "2.1.3",
"cordova-plugin-ionic-webview": "^2.3.1",
"cordova-plugin-splashscreen": "5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-x-socialsharing": "5.4.4",
"cordova-sqlite-storage": "2.5.2",
"cordova-wheel-selector-plugin": "1.1.2",
"es6-promise-plugin": "4.2.2",
"font-awesome": "4.7.0",
"ionic-angular": "3.9.2",
"ionic-img-viewer": "^2.9.0",
"ionicons": "3.0.0",
"moment": "^2.18.1",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"underscore": "^1.9.1",
"zone.js": "0.8.26"

我想在我的应用程序中实现wheelselector,因此我使用了以下指南:    https://ionicframework.com/docs/v3/native/wheelselector-plugin/

在.html文件中,我创建了一个离子按钮,并在单击时调用该函数以显示选择器:

jsonData = {    ......   }

   selectANumber() {
    this.selector.show({
    title: "How Many?",
    items: [
     this.jsonData.numbers
    ],
   }).then(
   result => {
    console.log(result[0].description + ' at index: ' + 
   result[0].index);
  },
  err => console.log('Error: ', err)
  );
}

但不幸的是得到了错误。

1 个答案:

答案 0 :(得分:0)

如果您使用的是ionic 3,请尝试降级到插件的v4。

$ npm install --save @ionic-native/wheel-selector@4

,并且在导入插件时不要添加 / ngx 。这应该起作用。