startRecognize(){ let that = this if (!window.plus) return // 使用vuex来创建scan二维码 that.$store.commit('changescan', new plus.barcode.Barcode('qrcode')) // 设置扫描之后的函数回调 that.$store.commit('changeonmarked',onmarked) // 开始扫描 that.$store.commit('staticScan') //设置扫描二维码页面样式,根据需求自行调整 barcode.setStyle({ background:'#8f9494', height:"100%" }); //成功之后的函数回调 functiononmarked(type, result, file) { switch (type) { case plus.barcode.QR: type = 'QR' break case plus.barcode.EAN13: type = 'EAN13' break case plus.barcode.EAN8: type = 'EAN8' break default: type = '其它' + type break } // 获得扫描的二维码路径 result = result.replace(/\n/g, '') //在data中设置变量codeUrl that.codeUrl = result } }