小程序传参 URL编码解码(url?后边的正常传参)encodeURIComponent decodeURIComponent

编码

const urlH5 =encodeURIComponent(url) ;
    wx.navigateTo({
      url: '/packageB/pages/authentication/index?urlH5='+urlH5
    });

解码

   console.log("options",decodeURIComponent(options.urlH5));
    that.setData({
      url:decodeURIComponent(options.urlH5)
    })

你可能感兴趣的:(前端,javascript,c++)