1.最重要的就是一个函数uni.scanCode()
下边是我的代码可以直接使用文章来源:https://www.toymoban.com/news/detail-844867.html
<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);
}
})
},
上述代码就直接实现了扫描功能很简单记得定义下扫描结果!有啥问题随时@我文章来源地址https://www.toymoban.com/news/detail-844867.html
到了这里,关于uniapp写微信小程序实现二维码条形码扫描识别的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!