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); }
微信小程序 支付宝小程序 支付宝微信扫码进小程序后参数的获取方式, 两个有点差异
原文:https://www.cnblogs.com/l24118028/p/14738917.html