ionic+capacitor引入cordova-plugins插件示例

1.前言:ionic7以后官方推荐项目插件使用capacitor插件,因为capacitor插件并不丰富所以往往需要用到cordova插件库。

2.官网说明:

capacitor使用cordova Plugins官方说明

Installing Cordova Plugins

Capacitor plugins are installed using your regular package manager and then synced to the native project(s). The installation process is the same for Cordova plugins in Capacitor.

Install the plugin, sync, and then finish any required native project configuration (see Variables and Hooks):

npm install cordova-plugin-name
npx cap sync

If the Cordova plugin has an @awesome-cordova-plugins wrapper, you can also install it for TypeScript support:

npm install @awesome-cordova-plugins/plugin-name

3.示例

ionic+capacitor项目中使用实现ble蓝牙插件使用

1.安装ble插件
 npm i cordova-plugin-ble-central
 npm install @awesome-cordova-plugins/ble
2.同步
npx cap sync 
3.查看列出所有插件
npx cap ls
4.正常的构建  
ionic capacitor build android

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值