Using a Cordova plugin with Capacitor

丶灬走出姿态 提交于 2020-12-29 09:27:06

问题


I've been working through this example: https://capacitor.ionicframework.com/docs/basics/cordova

I've run:

npm install cordova-plugin-qrscanner
npx cap sync

and I can see the plugin installed in my node_modules.

What I do not know how to do is call one of the functions on the cordova-plugin. I'm wondering if I need a packager like webpack?

I'm also confused as to how this works if the cordova plugin contains native swift (or other) code.


回答1:


Remember you can install the native wrapper too. It should work just the same as using it with Cordova.

npm install @ionic-native/qr-scanner

From:

ionic cordova plugin add cordova-plugin-qrscanner
npm install @ionic-native/qr-scanner

To:

npm install cordova-plugin-qrscanner
npm install @ionic-native/qr-scanner
npx cap sync

https://ionicframework.com/docs/native/qr-scanner



来源:https://stackoverflow.com/questions/52716200/using-a-cordova-plugin-with-capacitor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!