微信小程序 支付宝小程序 支付宝微信扫码进小程序后参数的获取方式, 两个有点差异

  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);
    }

 

posted @ 2021-05-07 14:07  深海里的星星i  阅读(436)  评论(1)    收藏  举报