参数中含有参数传递前需要先编码
直接传参,会去掉参数中?及后面的部分,传递前先编码,接收时解码
wx.navigateTo({ url: `/pages/login/login?redirect_url=/pages/job-detail/job-detail?id=1`, })
传递前编码:encodeURIComponent
let redirectUrl = encodeURIComponent(`/pages/job-detail/job-detail?id=1`) wx.navigateTo({ url: `/pages/login/login?redirect_url=${redirectUrl}`, })
接收时解码:decodeURIComponent
onLoad: function (options) { const redirectUrl = decodeURIComponent(options.redirect_url) this.data.redirectUrl = redirectUrl },
来源:https://www.cnblogs.com/qq254980080/p/12298150.html