当参数的值为url
的时候,在options中的值没有参数“?”
之后字符串被截取。
*例如:
let url="http://baidu.com/?a=1&b=2"
wx.navigateTo({
url: `detail?url=${url}`
})
可以使用encodeURIComponent()
:函数可把字符串作为 URI
组件进行编码。
let url=encodeURIComponent("http://baidu.com/?a=1&b=2")
wx.navigateTo({
url: `detail?url=${url}`
})
在获取的时候decodeURIComponent(options.url)