1. 扫一扫
扫描二维码、条形码
1.1. API 调用
1.1.1. QN.scan(options)
扫一扫
API 调用入参
| 参数名 | 类型 | 是否可选 | 默认值 | 含义 |
|---|---|---|---|---|
options |
Function Object |
选项 | ||
options.success |
Function |
可选 | 调用成功的回调函数 | |
options.error |
Function |
可选 | 调用失败的回调函数 |
API 响应结果
| 参数名 | 类型 | 是否一定返回 | 含义 |
|---|---|---|---|
result |
Object |
响应对象 | |
result.code |
String |
错误码,成功为 QAP_SUCCESS;失败为其他 |
|
result.msg |
String |
错误信息 | |
result.data.type |
String |
码类型:二维码 QR,条码 Bar,其他 OTHER |
|
result.data.data |
String |
码内容 |
调用示例
QN.scan(result => {
console.log(result);
});
QN.scan()
.then(result => {
console.log(result);
}, error => {
console.log(error);
})
QN.scan({
success(result) {
console.log(result);
},
error(error) {
console.log(error);
}
})
.then(result => {
console.log(result);
}, error => {
console.log(error);
})