当我添加插件:离子cordova插件时,添加cordova-sqlite-storage以供使用https://ionicframework.com/docs/angular/storage,这有什么麻烦吗?我正在使用电容器。如果我添加了cordova插件怎么办?。
当添加离子Cordova插件时,添加cordova-sqlite-storage
[WARN] About to integrate your app with Cordova.
We now recommend Capacitor (https://ion.link/capacitor) as the official native runtime for Ionic. To learn about
the differences between Capacitor and Cordova, see these docs[1]. For a getting started guide, see these docs[2].
[1]: https://ion.link/capacitor-differences-with-cordova-docs
[2]: https://ion.link/capacitor-using-with-ionic-docs
答案 0 :(得分:3)
是的,可以将Cordova插件与Capacitor一起使用。无法保证它们将完全兼容,但是您可以在项目中安装和使用它们。
但是,您不必运行ionic cordova plugin add cordova-plugin-name
,因为那样可以有效地为您的应用程序初始化Cordova,这不是您想要的。
相反,请安装Cordova插件并同步电容器:
npm install cordova-plugin-name
npx cap sync
如果该插件来自Ionic Native,则还必须在Cordova插件之前安装Ionic本机软件包:
npm install @ionic-native/plugin-name
npm install cordova-plugin-name
npx cap sync
在此处查看更多信息:Capacitor - Using Cordova Plugins and Ionic Native