将Cordova插件与电容器一起使用 [英] Using a Cordova plugin with Capacitor

查看:84
本文介绍了将Cordova插件与电容器一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究这个例子: https://capacitor.ionicframework.com/docs/basics/cordova

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

我已经跑步:

npm install cordova-plugin-qrscanner
npx cap sync

,我可以看到我的node_modules中安装了该插件.

and I can see the plugin installed in my node_modules.

我不知道该怎么做,就是调用cordova插件上的功能之一.我想知道是否需要像webpack这样的打包程序?

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?

如果cordova插件包含本机swift(或其他)代码,我也对此感到困惑.

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

推荐答案

请记住,您也可以安装本机包装.它应该与在Cordova中使用时一样.

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

发件人:

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

收件人:

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

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

这篇关于将Cordova插件与电容器一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆