fix:添加扫码测试

This commit is contained in:
shijing 2025-03-26 08:50:50 +08:00
parent f8ad4a7e09
commit b810a01c31
1 changed files with 20 additions and 2 deletions

View File

@ -15,6 +15,11 @@
<div v-if="currentM == '二维码'"> <div v-if="currentM == '二维码'">
<scQrCode text="xxxx"></scQrCode> <scQrCode text="xxxx"></scQrCode>
</div> </div>
<div v-if="currentM == 'scanner'">
<h1>扫描二维码</h1>
<el-button @click="scanCode">扫码</el-button>
<p>扫描结果:{{ scannedResult }}</p>
</div>
<div v-if="currentM == 'ehsSelect'"> <div v-if="currentM == 'ehsSelect'">
<ehsSelect <ehsSelect
:apiObj="apiObj" :apiObj="apiObj"
@ -125,6 +130,7 @@ export default {
return { return {
menu: [ menu: [
"二维码", "二维码",
"scanner",
"xtSelect", "xtSelect",
"ehsSelect", "ehsSelect",
"scEcharts", "scEcharts",
@ -163,7 +169,7 @@ export default {
], ],
x2sf: 10, x2sf: 10,
x2sfs: [10, 20], x2sfs: [10, 20],
scannedResult:"",
chartOption: { chartOption: {
textStyle: { textStyle: {
fontFamily: 'Inter, "Helvetica Neue", Arial, sans-serif', fontFamily: 'Inter, "Helvetica Neue", Arial, sans-serif',
@ -212,7 +218,9 @@ export default {
}, },
}; };
}, },
mounted() {}, mounted() {
window.onScanResult = this.onScanResult;
},
methods: { methods: {
getMember(data) { getMember(data) {
console.log(data); console.log(data);
@ -220,6 +228,16 @@ export default {
showx2() { showx2() {
// console.log(this.x2) // console.log(this.x2)
}, },
scanCode(){
if (window.Android) {
window.Android.openScanner();
} else {
alert("当前环境不支持扫码");
}
},
onScanResult(data) {
this.scannedResult = data;
},
}, },
}; };
</script> </script>