如何使用 cordova 插件 cordova-plugin-inline-datepicker?

How to use cordova plugin cordova-plugin-inline-datepicker?

我正在开发 ionic 4 应用程序并想使用 cordova 插件 cordova-plugine-inline-datepicker

而不是原生 ionic datepicker 插件,但我收到错误

Uncaught (in promise): TypeError: Cannot read property 'create' of undefined

Impostazioni.ts

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams,Platform } from 'ionic-angular';
declare var cordova:any;

@IonicPage()
@Component({
selector: 'page-impostazioni',
 templateUrl: 'impostazioni.html',
 })
 export class ImpostazioniPage {
 constructor(private platform: Platform) {

 show(){
 this.platform.ready().then(() => {
  //alert('dentro');
  let element = document.querySelector('.inline-datepicker');
  let options = {
    'mode': 'date',//cordova.plugins.DatePicker.Mode.DATE'', // default is 
  DATE_AND_TIME
    'date': new Date(),
  };
  let success = function (data) {
    // this callback is called everytime input is changed
    //document.querySelector('.date-label').innerText = new 
  Date(data.date).toLocaleDateString();
    alert('success');
  }
  let error = function (data) {
    // this callback is called everytime input is changed
    //document.querySelector('.date-label').innerText = new 
  Date(data.date).toLocaleDateString();
    alert('error: ' + data);
  }


  cordova.plugins.DatePicker.create(element, options,success, error);

    cordova.plugins.DatePicker.show(element, options,success, error);
});
}
}
}

impostazioni.html

<ion-content padding>
<div class="date-label" (click)="show()">No date selected</div>
<div class="inline-datepicker" ></div>
</ion-content>

解决方案:我是这样安装插件的:

npm i cordova-plugin-inline-datepicker

但正确的方法是:

ionic cordova plugin add cordova-plugin-inline-datepicker

现在插件在插件列表中比较,错误不再比较。