獲取微信小程序生成指定頁面並且帶有參數的太陽碼的參數

微信小程序生成指定頁面並且帶有參數的太陽碼,掃碼進入該頁面拿不到太陽碼裏邊帶的參數,記錄一下

解決辦法:

微信提供encodeURIComponent方法獲取

 

文檔:

https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.getUnlimited.html


實例:

onLoad:function(query) {

    let that = this;

    if (query.scene){

      const scene = decodeURIComponent(query.scene)
      console.log(sence)  // 22&shopname

      var id = scene.split('&')[0]

      var shopName = scene.split('&')[1]

      that.setData({

        sid: id,

        shopName: shopName

      })

    }

}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章