微信小程序 支付宝小程序 支付宝微信扫码进小程序后参数的获取方式, 两个有点差异
onLaunch: function () { const params = wx.getLaunchOptionsSync(); let str = params.query ? params.query.q : ""; if (str) { str = decodeURIComponent(str); if (str.indexOf("qr=") === -1) return; const qr = str.split("qr=")[1]; this.$store.commit("save_qr", qr); } },
上面微信
下面支付宝
const str = option.query ? option.query.qrCode : ""; if (str) { if (str.indexOf("qr=") === -1) return; const qr = str.split("qr=")[1]; this.$store.commit("SAVE_QR", qr); }
本想把生活活成一首诗, 时而优雅 , 时而豪放 , 结果活成了一首歌 , 时而不靠谱 , 时而不着调