问题场景
- 在微信小程序中,页面之间传递参数时,参数时链接时,在下个页面出现链接乱码的问题
解决办法(先通过 encodeURIComponent
进行编码)
wx.navigateTo({
url: '/pages/hot_detail_url/hot_detail_url?id=' + e.currentTarget.dataset.id + '&url=' + encodeURIComponent(e.currentTarget.dataset.url)
})
在接收页面中进行解码(decodeURIComponent
)
that.setData({
url: decodeURIComponent(options.url)
});
如在微信小程序页面中需要直接打开链接式的文章时,如何进行展示 (在wxml文件
中直接写以下代码) ?
<web-view src="{{url}}"></web-view>