# scanCode
扫描二维码并返回扫描结果。
# 支持说明
应用能力 | Android | iOS | PC | 预览效果 |
---|---|---|---|---|
小程序 | 3.5.0 | 3.5.0 | X | 扫码预览 用BoosHi扫码或PC端点击 |
网页应用 | 待开发 | 待开发 | X | 待补充 |
# 输入
继承标准对象输入,扩展属性描述:
名称 | 数据类型 | 必填 | 默认值 | 描述 |
---|---|---|---|---|
scanType | string[] | 否 | ['qrCode','barCode','datamatrix','pdf417'] | 扫码类型。传入多个类型,代表可以支持多种类型的扫码。扫码类型定义如下: * qrCode :二维码* barCode :条形码* datamatrix :Data Matrix 码* pdf417 :PDF417 条码 |
barCodeInput | boolean | 否 | false | 是否支持手动输入条形码待开发 |
# 输出
success
返回对象的扩展属性:
名称 | 数据类型 | 描述 |
---|---|---|
result | string | 扫描结果 |
# 示例代码
bz.scanCode({
scanType: [
"barCode",
"qrCode",
"datamatrix",
"pdf417"
],
barCodeInput: true,
success(res) {
console.log(JSON.stringify(res));
},
fail(res) {
console.log(`scanCode fail: ${JSON.stringify(res)}`);
}
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
success
返回对象示例:
{
"result": "https://baidu.com",
"errMsg": "scanCode:ok"
}
1
2
3
4
2
3
4