更新记录
1.0.17(2025-09-26)
新增 sendSetScanner 方法,支持通过广播方式控制PDA扫码参数,如打开/关闭扫码引擎、设置广播action等,具体使用方法可以参考 通用PDA扫码插件的示例项目https://ext.dcloud.net.cn/plugin?name=hh-pda
1.0.16(2025-09-25)
修复isRegister类型声明
1.0.15(2025-09-25)
导出isRegister用于判断是否已注册扫码监听
查看更多平台兼容性
uni-app(4.81)
| Vue2 | Vue3 | Vue2插件版本 | Chrome | Safari | app-vue | app-vue插件版本 | app-nvue | Android | Android插件版本 | iOS | 鸿蒙 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| - | √ | 1.0.15 | × | × | √ | 1.0.15 | - | 12.0 | 1.0.15 | × | × |
| 微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
|---|---|---|---|---|---|---|---|---|---|---|
| × | × | × | × | × | × | × | × | × | × | × |
uni-app x(4.81)
| Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
|---|---|---|---|---|---|
| × | × | 12.0 | × | × | × |
优博讯PDA扫码插件
本插件集成了优博讯SDK,如果不需要集成PDA的SDK,可以使用 通用PDA扫码插件https://ext.dcloud.net.cn/plugin?name=hh-pda
插件使用说明
插件市场附带的示例项目是基于uniapp-x的,要是想体验在uniapp上的使用效果,请参考此项目https://gitcode.com/hu382337381/you_bo_xun_sao_ma_cha_jian_u_n_i_a_p_p_shi_li
简单使用,只需初始化并注册扫码监听即可,如下所示,更多api使用可以参考示例项目中的详细使用
<template>
<view class="content">
<text>扫码图片:</text>
<view class="image">
<image class="image-content" :src="base64Image"></image>
</view>
<text>扫码码值:</text>
<view class="code">
<text class="f-s-14">{{code}}</text>
</view>
</view>
</template>
<script setup>
import { initScanner, registerScanner, unregisterScanner, getCode, getImage, sendGetImage } from "@/uni_modules/hh-ubx-pda";
const code = ref('');
const base64Image = ref("");
const init = () => {
//初始化pda
initScanner();
//注册扫码监听
registerScanner();
uni.showToast({
title: "初始化成功!",
icon: "none",
mask: false
})
}
onLoad(() => {
init();
//获取扫码值
getCode(_code => {
code.value = _code;
//发送获取图片的请求
sendGetImage();
});
//获取扫码图片,图片为base64格式
getImage(_img => {
base64Image.value = _img;
});
});
onUnload(() => {
//移除扫码监听
unregisterScanner();
uni.showToast({
title: "移除扫码监听!",
icon: "none",
mask: false
})
})
</script>
<style lang="scss" scoped>
.content {
width: 100%;
height: 100%;
padding: 15rpx;
display: flex;
flex-direction: column;
}
.image {
width: 100%;
height: 200px;
border: 1px solid rgb(41, 78, 162);
>.image-content {
width: 100%;
height: 100%;
}
}
.code {
width: 100%;
height: 35px;
border: 1px solid rgb(41, 78, 162);
margin-top: 15rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.action-btn-list {
margin-top: 15rpx;
display: flex;
flex-direction: row;
flex-wrap: wrap;
>.action-btn {
width: 33.33%;
padding: 20 15px;
background-color: rgb(41, 78, 162);
border-radius: 2px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border: 1px solid #ccc;
>.f-s-14,
.f-s-12 {
color: #fff;
}
&:hover {
background-color: #fff;
}
}
}
</style>

收藏人数:
购买源码授权版(
试用
使用 HBuilderX 导入示例项目
赞赏(0)
下载 99
赞赏 0
下载 10668062
赞赏 1797
赞赏
京公网安备:11010802035340号