pc和h5生成二维码跳转到微信小程序
先使用qrcode生成二维码,绑定对应连接,分别引入qrcode插件
pc:
<div class="codeDes">微信扫描二维码跳转</div> <div id="qrcode"></div>
$('#qrcode').qrcode({width: 64,height: 64,correctLevel:0,text: "https://wap.BalleMax.com/miniprogram?action=go&customerNo="+that.customerNo+"&orderId="+that.orderId+"&apexId="+that.apexId}); //动态绑定对应二维码
H5:
<div class="recommendedNumber">长按或保存二维码</div> <div class="qrCode"> <vue-qr :size="300" class="erweima" :text="appSrc"> </vue-qr> </div>
// 拼接网址。 spellUrl() { //todo 生产环境改成https this.appSrc = "https://wap.BalleMax.com/miniprogram?action=go&customerNo="+this.customerNo+"&orderId="+this.orderId+"&apexId="+this.apexId; console.log("paths: " + this.appSrc) }
像上面这样二维码和参数都是生成好了,可是要注意,想让二维码正确小程序,必须在微信公众平台配置对应参数:javascript
若是想动态传参,必需要在https://wap.BalleMax.com/原连接后面跟随miniprogram?action=go(这里我是随便取的,你也能够aaa?bb=c)而后将再链接以后须要的参数,使用&customerNo=111&orderId=222就能够(&参数名=值)html
注意:开发环境每测试一条不一样参数的二维码,都须要在测试连接里面添加一条新的,目前只能存在五条测试连接,固然是能够删除从新添加的喔。vue
到上线的时候建议先发一版测试,别忘配置二维码跳转规则,先测一下,正常状况下是能够动态跳转的。java
若是有帮助到你,能够给我一颗当心心吗~小程序