更新记录
1.0.1(2025-06-12) 下载此版本
uniapp的扫码不支持H5,使用html5-qrcode扫码完成该功能
平台兼容性
uni-app(4.66)
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | × | × | × | × | × | × | × |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
× | × | × | × | × | × | × | × | × | × | × |
1、引入组件
import geH5Scancode from "@/components/ge-h5-scancode/ge-h5-scancode.vue"
2、触发扫码
this.$refs.geH5Scancode.start({
success: (decodedText, decodedResult) => {
this.decodedText = decodedText
this.decodedResult = decodedResult
},
fail: (err) => {
console.log('err', err)
},
})
注意事项
1、先安装html5-qrcode,如pnpm install --save-dev html5-qrcode
2、h5需要在https或者localhost中访问,否则无法使用