更新记录

1.0.0(2023-09-04)

首次提交


平台兼容性

Android iOS
× 适用版本区间:11 - 16

原生插件通用使用流程:

  1. 购买插件,选择该插件绑定的项目。
  2. 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
  3. 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
  4. 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
  5. 开发完毕后正式云打包

付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios

注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择


蓝牙/Esc指令打印「 仅支持IOS 」

1、插件说明

​ 此插件适用于 支持Esc指令打印机支持Wifi和蓝牙模式 如有问题请联系我 wx:petalmailo。

2、Wifi代码示例


        printer: function () {
            const printerWifi = uni.requireNativePlugin('Hd-IosPrinterWifi');
            let url = '192.168.0.193' // IP
            let port =  '8080',    // 端口
            let data =
                '023033653803543233303832313030303030303030333832303034000000000000000000000000000000000000004350313830323330383137313039350000000000000000000000000031001b401d21001b321b61001b61011b4a101d2100d0a1bca6bfecc5dcd5a8bca6b5ea32301b4a101b4a101d2111bde1cbe3b5a5a3a8c9ccbba7c1aaa3a91b4a101b61001b4a101d2111c8a1b2cdbac5a3ba381b4a101b61001b4a101d2100bbe1d4b1b1e0bac5a3ba323338343438341b4a101b4a10bbe1d4b1b5c8bcb6a3ba1b4a101b4a10b6a9b5a5b5a5bac5a3ba333732333832333038323131363131303030391b4a101b4a10bde1cbe3cab1bce4a3ba323032332d30382d32312031363a31313a35391b4a101b4a101d2100c8cbcafda3ba20202031c8cb1b4a102d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d1b4a10202020b2cbc3fb2020202020202020202020202020202020202020202020b5a5bcdb202020202020cafdc1bf1b4a101b61011b4a101d21002d2d2d2d2d2d2d2dbfbed5a8ceef2d2d2d2d2d2d2d2d1b4a101b61001d21001b4a101d2101c9b3e0c7bca6c8e2b4aea3a83135b7d6d6d3a3a9202020202020202020202020202020352e30202020202020202035201b4a102d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d1b4a101b4a101d2101bacfbcc6a3ba2020202020202020202020202020202020202020202020202020202020202020202020202031b5c01b4a101b4a10b2cdbedfb7d1a3ba2020202020202020202020202020202020202020202020202020202020202020202020a3a4302e311b4a102d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d1b4a101b4a10d7dcbcdba3ba20202020202020202020202020202020202020202020202020202020202020202020a3a432352e311b4a101d21002d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d1b4a101b4a10c7b0cca8cfd6bdf0a3baa3a432352e311b4a101b4a10bbe1d4b1c7a9d7d63a1b4a102d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d1b4a101b4a10cad5d2f8d4b13abbe1d4b1d7d4d6fa1b4a102d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d1b4a101b4a101d2100201b4a101b4a10201b4a101b4a10201b4a101b4a10201b4a101d5642301b4202031b70001eff1b4a101b4003e4';
            printerWifi.write(url, port, data, (result) => {
                uni.showModal({
                    content: '打印结果' + JSON.stringify(result)
                });
            });
        }

2、Wifi代码示例


        <template>
            <view class="content">
                <view class="way" @click="scanDevices()">开始扫描设备</view>
                <view class="way" @click="stopScan()">停止扫描设备</view>
                <scroll-view scroll-y style="height: 500rpx">
                    <view class="item" v-for="(item, index) in deviceAr" :key="item.address">
                        <view class="item-title">名称:{{ item.name }}({{ item.address }}){{ item.mac }}</view>
                        <view style="flex-direction: row; justify-content: space-around; display: flex">
                            <view class="btn" @click="sendData(item)">发送数据</view>
                        </view>
                    </view>
                </scroll-view>
            </view>
        </template>

        <script>
        const PrinterBl = uni.requireNativePlugin('Hd-IosPrinterBle');
        export default {
            data() {
                return {
                    deviceAr: []
                };
            },
            onLoad() {
                //判断蓝牙是否开启;
                bleScanTool.isBluetoothEnabled((result) => {});
            },
            methods: {
                sendData: function (item) {
                    const { mac, address } = item;
                    let data =
                        '023031313004340000000000000000000000000000000000000054323330383139303030303030303033373632310000363137376336366337623631302e302e302e30000000000000000000000000000000000000000000310053495a45203430206d6d2c3330206d6d200a4741502032206d6d2c3330206d6d200a53504545442034200a44454e534954592037200a444952454354494f4e2031200a52454652454e43452031302c30200a434c53200a544558542031302c32352c2254535332342e424632222c302c312c312c22b4f2d3a1b2e2cad4b3c9b9a622200a5152434f44452031302c36302c482c362c412c302c22414243616263313233220a5052494e5420312c31200a434c530a5441534b454e44035c';
                    if (mac.length > 0) { 有mac地址必传mac地址
                        bleScanTool.sendData(data, mac, (result) => {
                            uni.showModal({
                                content: JSON.stringify(result)
                            });
                        });
                    } else {
                        bleScanTool.sendData(data, address, (result) => {
                            uni.showModal({
                                content: JSON.stringify(result)
                            });
                        });
                    }
                },
                scanDevices: function () {
                    this.deviceAr = [];
                    bleScanTool.scanDevices((result) => {
                        console.log('收到数据啦啦啦' + JSON.stringify(result));
                        this.deviceAr.push(result);
                    });
                },
                stopScan: function () {
                    bleScanTool.stopScan();
                }
            }
        };
        </script>
作者qq 860987228 wx:petalmailo

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问