对于跳转页面参数携带特殊符号或者过长导致被截取的问题

使用encodeURIComponentdecodeURIComponent,当前是在小程序项目内使用

wx.navigateTo({
          // 跳转到webview页面
          url: `/pages/mine/carbon/carbonCodeDetail?url=${encodeURIComponent(url)}`,
      });
 onLoad: function (options) {
    // console.log(options,'跳转')
    // console.log(decodeURIComponent(options.url));
    let newUrl=decodeURIComponent(options.url)
    // console.log(newUrl)
    this.setData({
      url: newUrl, // 从跳转页面中传过来的url在options中可以拿到
    });
  },

猜你喜欢

转载自blog.csdn.net/qq_40004867/article/details/129836771