原生安卓嵌入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; },