更新记录
1.0.0(2023-11-23) 下载此版本
使用方法
- 引用
复制代码
import mrsongOrc from '@/uni_modules/mrsong-orc/components/mrsong-orc/mrsong-orc.vue';
- 扫码
复制代码
<template> <view class="content"> <mrsong-orc @getDetail='getDetail' width="300px" height="300px" scanMode="scanCode"></mrsong-orc> </view> </template>
- 图文识别
- 默认全屏
复制代码
<template> <view class="content"> <mrsong-orc @getDetail='getDetail' scanMode="normal"></mrsong-orc> </view> </template>
复制代码
export default { components: { mrsongOrc }, data() { return {}; }, methods: { getDetail(e) { console.log('<<<<yyds>>>>>', e); } } };
参数props
复制代码
props: { // 照相模式还是扫码模式(normal:代表照相模式,scanCode:代表扫码模式,注意微信暂不支持扫描小程序码,不要问为什么,微信功能是这样) scanMode: { type: String, default: 'scanCode' }, // 扫码成功用是否用震动来提示(1:表示震动模式,2:表示mp3模式) scanTip: { type: Number, default: 1 }, // 相机的宽度 width: { type: String, default: '250px' }, // 相机的高度 height: { type: String, default: '250px' }, // 扫描线距离扫描框顶部高度 toTop: { type: [String, Number], default: 40 }, // 获取数据提示 title: { type: String, default: '成功获取数据,请看控制台' }, // 是否展示提示 showToast: { type: Boolean, default: true }, // 扫面线颜色rgba或者hex bgColor: { type: String, default: 'rgba(0, 122, 255, 1)' }, // 扫面线一个来回运动时间 time: { type: [String, Number], default: 3000 } }
- 默认全屏
平台兼容性
uni-app
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | × | - | - | × | × | - | - | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
√ | × | × | × | × | × | - | × | × | × | × |
示例代码运行到真机上了就灰蒙蒙的一片,手机是iqoo 10, 系统是 orgin os 4