原生安卓嵌入vue打包的H5,在H5中调用原生摄像头扫码,且扫描回调返回数据

<div class="code">
	<img class="scan" src="../assets/images/scan.png" alt="" @click.stop="openQrcode('getScanData')" />
	<input class="input" type="number" placeholder="请输入核销码" v-model="code" />
</div>

 

methods: {
    // 安卓的扫码回调
	getScanData(str) {
		this.code=str;
	},
   openQrcode() {
        window.android.toScan("31");
    }
},
created: function () {
	window.getScanData = this.getScanData;
},

  

posted @ 2024-01-11 17:57  MiniDuck  阅读(175)  评论(0编辑  收藏  举报