传值
需要跳转到下一个页面,在传值的时候,打算传递过去的值也有问号,如果不进行处理,在下一个页面只会取到问好前面的内容;
var href="https://www.baidu.com?test=1" //测试名字
href =encodeURIComponent(newAction.val);
wx.navigateTo({
url: '../advertising/advertising?href='+href,
})
需要使用encodeURIComponent进行编码
取值
在此页面接口他的值;并且进行转义;
onLoad: function (options) {
console.log(decodeURIComponent(options.href))
this.setData({
href:decodeURIComponent(options.href)
})
}
需要使用decodeURIComponent进行解码
本文详细介绍了在页面跳转时如何使用encodeURIComponent进行URL参数编码,以确保包含特殊字符的值能完整传递。同时,也讲解了在目标页面中如何使用decodeURIComponent进行解码,以正确获取并显示传递过来的值。
9088

被折叠的 条评论
为什么被折叠?



