Jump strip parameters
原来的url https://ultimavip.cn/m/mposter.html?source=gxw_001_t_mposter
jumping over becomes
https://ultimavip.cn/m/mposter.html这种形式了只有一半
// 跳转到h5页面小程序的代码
targetUrl: function () {
console.log(this.data.mod_textUrl)
wx.navigateTo({
url: '../webview/webview?url=' + encodeURIComponent(this.data.mod_textUrl), //这里就需要编码,因为有"?"可能浏览器不认 编码码成 https%3A%2F%2Fultimavip.cn%2Fm%2Fmposter.html%3Fsource%3Dgxw_001_t_mposter
})
}
//第二个页面进行解码
onLoad: function (options) {
this.setData({
targetUrl: decodeURIComponent(options.url) //用decodeURIComponent进行解码就是还原刚开始的url路径
})
console.log(options.url)
}
Summarize
I tried a lot of methods at the beginning. At first, I wanted to pass the array of this path containing the url together, but I found that I still intercepted everything after the "?". I also looked for a method on the Internet, but I didn't try it. Success, I originally wanted to do it by myself, and I didn't want to trouble others, but the result was that my knowledge was too narrow, and maybe I didn't have deep contact. I didn't think it was a coding problem. My leader found it. Hey, give it to others. I'm in trouble, and I don't know how far I can go on this road. Sometimes I feel really tired.