使用encodeURIComponent和decodeURIComponent,当前是在小程序项目内使用
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中可以拿到
});
},