1.最重要的就是一个函数uni.scanCode()
下边是我的代码可以直接使用
<view @click="scanCode">
<img src="../../../static/images/icon/scan.png" alt="" style="width: 20px; height: 20px" />
</view>
scanCode() {
uni.scanCode({
success: (res) => {
this.result = res.result
console.log(this.result, "0000000");
this.merInfo.terminalSn = this.result
console.log(this.result, "0000000");
},
fail: (res) => {
uni.showToast({
title: '扫描失败',
icon: 'none'
})
console.log(res);
}
})
},
上述代码就直接实现了扫描功能很简单记得定义下扫描结果!有啥问题随时@我