<script>
import {Toast} from 'vant';
let scan = null;
export default {
data() {
return {
codeUrl: '',
}
},
methods: {
//创建扫描控件
startRecognize() {
if (!window.plus){Toast(this.$t('h5plus.err_cannot')); return;}
scan = new window.plus.barcode.Barcode('bcid',[window.plus.barcode.QR], {
top:"40%",
scanbarColor: '#2E49C0',
frameColor: '#2E49C0'
});
scan.onmarked = (type, result)=> {
switch (type) {
case window.plus.barcode.QR:
type = 'QR';
break;
case window.plus.barcode.EAN13:
type = 'EAN13';
break;
case window.plus.barcode.EAN8:
type = 'EAN8';
break;
default:
type = '其它' + type;
break;
}
result = result.replace(/\n/g, '');
this.codeUrl = result;
thi
plus实现扫码功能
最新推荐文章于 2024-12-14 17:10:35 发布
本文详细介绍了如何在移动应用中利用Plus SDK集成扫码功能。从下载SDK到配置项目,再到编写代码实现扫描二维码和条形码,一步步解析整个过程,帮助开发者快速在自己的应用中添加这一实用特性。

最低0.47元/天 解锁文章
1万+





